From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id YKwuAUFrLWEXLgEAgWs5BA (envelope-from ) for ; Tue, 31 Aug 2021 01:35:29 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id WAFVOEBrLWEQNgAAbx9fmQ (envelope-from ) for ; Mon, 30 Aug 2021 23:35:28 +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 A928A12BAD for ; Tue, 31 Aug 2021 01:35:28 +0200 (CEST) Received: from localhost ([::1]:40824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKqoJ-0004qU-Ny for larch@yhetil.org; Mon, 30 Aug 2021 19:35:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKqnu-0004q7-Rw for guix-patches@gnu.org; Mon, 30 Aug 2021 19:35:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKqnu-0001Sv-JL for guix-patches@gnu.org; Mon, 30 Aug 2021 19:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKqnu-0005ah-GQ for guix-patches@gnu.org; Mon, 30 Aug 2021 19:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50283] [PATCH v3 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 23:35: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 , Petr Hodina , Vincent Legoll Received: via spool by 50283-submit@debbugs.gnu.org id=B50283.163036645421421 (code B ref 50283); Mon, 30 Aug 2021 23:35:02 +0000 Received: (at 50283) by debbugs.gnu.org; 30 Aug 2021 23:34:14 +0000 Received: from localhost ([127.0.0.1]:60604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKqn7-0005ZM-Tz for submit@debbugs.gnu.org; Mon, 30 Aug 2021 19:34:14 -0400 Received: from out2.migadu.com ([188.165.223.204]:56054) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKqn1-0005Z1-7c for 50283@debbugs.gnu.org; Mon, 30 Aug 2021 19:34:10 -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=1630366445; 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=Svhbotid4lU0HBjKbU0iY91EMpXpaC229lPUe055xpo=; b=faYcl1AZnY5aChVrDIF42cim+BB+8oNhD8efkneRhiCeaRgG68oOhKqtY5QNbwBCWLjpvk +I+U+QiNYVOM/IGj5kI4sSIjqjaFJWVPtpHNrmeE+5lxgtkQCJctP9532zcMbDQPmKVfHI Iwaujy6Y/Hkk2cRjBtkXKSKE1JcEwMqOAhidC22G0IXZQxtlB27vtiO2rW87raiwR8kcJA Lf5pojf9U1WBx7uDFbEmKMSnRcDbD7c3YZ2zMH+ZXasal3+T/vgQ2hQbxyu/Jl+3DVUS/8 NK7NW+07nOf6oSznbjTY0KJBmXfTW3tztSO15rKScCnW9zJ7ZrkGWdjYpDESrw== Date: Mon, 30 Aug 2021 19:33:52 -0400 Message-Id: <20210830233353.19811-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: A928A12BAD X-Spam-Score: -4.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: xh70C3uZKZYy * 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..5901524269 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:non-copyleft "file:///LICENSE")))) + (define (qemu-patch commit file-name sha256-bv) "Return an origin for COMMIT." (origin -- 2.33.0