From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kGKcL39bLWHdDgEAgWs5BA (envelope-from ) for ; Tue, 31 Aug 2021 00:28:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +OIDK39bLWGlIwAA1q6Kng (envelope-from ) for ; Mon, 30 Aug 2021 22:28:15 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 82D5A11D9C for ; Tue, 31 Aug 2021 00:28:15 +0200 (CEST) Received: from localhost ([::1]:52402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKplG-00064d-KL for larch@yhetil.org; Mon, 30 Aug 2021 18:28:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKpl4-00063s-Mx for guix-patches@gnu.org; Mon, 30 Aug 2021 18:28:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49019) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKpl4-0008Bc-F4 for guix-patches@gnu.org; Mon, 30 Aug 2021 18:28:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKpl4-0003kR-9n for guix-patches@gnu.org; Mon, 30 Aug 2021 18:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu. References: <2c8e9e9d-c492-ea37-3414-c38e8bc4b2a1@raghavgururajan.name> In-Reply-To: <2c8e9e9d-c492-ea37-3414-c38e8bc4b2a1@raghavgururajan.name> Resent-From: Raghav Gururajan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 30 Aug 2021 22:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50283 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50283@debbugs.gnu.org Cc: Raghav Gururajan , phodina@protonmail.com, Vincent Legoll Received: via spool by 50283-submit@debbugs.gnu.org id=B50283.163036245114334 (code B ref 50283); Mon, 30 Aug 2021 22:28:02 +0000 Received: (at 50283) by debbugs.gnu.org; 30 Aug 2021 22:27:31 +0000 Received: from localhost ([127.0.0.1]:60563 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKpkZ-0003j8-4r for submit@debbugs.gnu.org; Mon, 30 Aug 2021 18:27:31 -0400 Received: from out1.migadu.com ([91.121.223.63]:20517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKpkV-0003im-Gh for 50283@debbugs.gnu.org; Mon, 30 Aug 2021 18:27:30 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raghavgururajan.name; s=key1; t=1630362445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ww2H86yAMDtA+Y4dmcJ8MusUvLt4QHbgQSw7ms8B6oo=; b=gudKEA14WC5ZT3ycPMYddAqHozF/a2PcQ0+5fdXZ2QhE49OsIUMqgGfOSpl3BH61oSdtDR YlJ/9Az0XroxKx3tWS5iC5HzWg50PvJoPFuqkr6nP7fBYmpTW8SQb5fUhs1aGPrPwehTpJ hgV9gIbCA4Xqmly1fMgdBl4zduwyeXkHd+oYaZfjzQlL8m6agyQQqiCwjIgmdY8IAMpR8F kq+knxH43c1umCEo2GgiDTr1T2F9xqgkPGtpjzYz1411rdvXvPBTHmoelSxprNw+RLxTDL Ff9YdeZ+MPa2p9lDOKesr+xpQbuIi8bR3Drx4dEKc9+sAxtwPyJz056DHfR41A== Date: Mon, 30 Aug 2021 18:27:11 -0400 Message-Id: <20210830222712.14136-1-rg@raghavgururajan.name> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Auth-User: rg@raghavgururajan.name X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Raghav Gururajan X-ACL-Warn: , Raghav Gururajan via Guix-patches From: Raghav Gururajan via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; none X-Migadu-Queue-Id: 82D5A11D9C X-Spam-Score: -4.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: w0U5Eq5IvapV * gnu/packages/virtualization.scm (libx86emu): New variable. Co-authored-by: Petr Hodina Co-authored-by: Vincent Legoll --- gnu/packages/virtualization.scm | 71 +++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm index e952c009b5..e1954ceb71 100644 --- a/gnu/packages/virtualization.scm +++ b/gnu/packages/virtualization.scm @@ -20,6 +20,9 @@ ;;; Copyright © 2021 Leo Famulari ;;; Copyright © 2021 Pierre Langlois ;;; Copyright © 2021 Dion Mendel +;;; Copyright © 2021 Vincent Legoll +;;; Copyright © 2021 Petr Hodina +;;; Copyright © 2021 Raghav Gururajan ;;; ;;; This file is part of GNU Guix. ;;; @@ -130,6 +133,74 @@ #:use-module (srfi srfi-26) #:use-module (ice-9 match)) +(define-public libx86emu + (package + (name "libx86emu") + (version "3.1") + (home-page "https://github.com/wfeldt/libx86emu") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url home-page) + (commit version))) + (file-name (git-file-name name version)) + (modules + '((guix build utils))) + (snippet + `(begin + ;; Remove git2log program file. + (delete-file "git2log") + ;; Remove variables that depends on git2log. + (substitute* "Makefile" + (("GIT2LOG.*=.*$") "") + (("GITDEPS.*=.*$") "") + (("BRANCH.*=.*$") "")) + #t)) + (sha256 + (base32 "104xqc6nj9rpi7knl3dfqvasf087hlz2n5yndb1iycw35a6j509b")))) + (build-system gnu-build-system) + (arguments + `(#:test-target "test" + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (include (string-append out "/include")) + (lib (string-append out "/lib"))) + ;; Correct the values of version and install directories. + (substitute* "Makefile" + (("VERSION.*=.*$") + (string-append "VERSION := " + ,version "\n")) + (("PREFIX.*=.*$") + (string-append "PREFIX := " out "\n")) + (("MAJOR_VERSION.*=.*$") + (string-append "MAJOR_VERSION := " + ,(version-major version) "\n")) + (("LIBDIR.*=.*$") + (string-append "LIBDIR = " lib "\n")) + (("/usr/include") include))))) + (delete 'configure)))) ; no configure script + (native-inputs + `(("nasm" ,nasm) + ("perl" ,perl))) + (synopsis "Library for x86 emulation") + (description "Libx86emu is a small library to emulate x86 instructions. The +focus here is not a complete emulation but to cover enough for typical +firmware blobs. You can, +@enumerate +@item intercept any memory access or directly map real memory ranges +@item intercept any i/o access, map real i/o ports, or block any real i/o +@item intercept any interrupt +@item provides a hook to run after each instruction +@item recognize a special x86 instruction that can trigger logging +@item use integrated logging +@end enumerate") + (license license:isc))) + (define (qemu-patch commit file-name sha256-bv) "Return an origin for COMMIT." (origin -- 2.33.0