From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id x/hZGkAMNGDbLgAA0tVLHw (envelope-from ) for ; Mon, 22 Feb 2021 19:55:44 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yCm8FUAMNGDUWwAAB5/wlQ (envelope-from ) for ; Mon, 22 Feb 2021 19:55:44 +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 aspmx2.migadu.com (Postfix) with ESMTPS id 74130105B5 for ; Mon, 22 Feb 2021 20:55:43 +0100 (CET) Received: from localhost ([::1]:47674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lEHJ0-0007Dh-BY for larch@yhetil.org; Mon, 22 Feb 2021 14:55:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lEHFT-0003S8-Kg for bug-guix@gnu.org; Mon, 22 Feb 2021 14:52:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46077) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lEHFT-0007D6-E8 for bug-guix@gnu.org; Mon, 22 Feb 2021 14:52:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lEHFT-0006t3-D0 for bug-guix@gnu.org; Mon, 22 Feb 2021 14:52:03 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#36117: [PATCH 4/4] services/qemu-binfmt: Use the F flag and the static output of QEMU. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 22 Feb 2021 19:52:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36117 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 36117@debbugs.gnu.org Received: via spool by 36117-submit@debbugs.gnu.org id=B36117.161402349326413 (code B ref 36117); Mon, 22 Feb 2021 19:52:03 +0000 Received: (at 36117) by debbugs.gnu.org; 22 Feb 2021 19:51:33 +0000 Received: from localhost ([127.0.0.1]:57620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEHEy-0006rr-Ab for submit@debbugs.gnu.org; Mon, 22 Feb 2021 14:51:33 -0500 Received: from mail-qt1-f178.google.com ([209.85.160.178]:39120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lEHEt-0006rM-FE for 36117@debbugs.gnu.org; Mon, 22 Feb 2021 14:51:28 -0500 Received: by mail-qt1-f178.google.com with SMTP id w6so2728345qti.6 for <36117@debbugs.gnu.org>; Mon, 22 Feb 2021 11:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kt42L0QvLOhsvlBZEq7U6NFD+niXRDzZ9fK01ux3nlI=; b=n80q9WvRlICxqn/76nA7ZX3eXCL9dDfM0qc9ANab89B6RlPcIjMeLdW77AmZ4ZSfRf PuUkm+acE6y1ljz6et3hysUTHifW/DJEfAHn++LSX19cqlja6GMI0N63m2NHtsB91pd9 T2K7a3Fv/j5qqsh8dFVxknOJkqbh+RhQugaAlu+ecNnFYZUNIXXSvaTtzZwjloKrALoj 0wgONChqCRnWhp4g4vhrZNlf4xSKqhj2Yrezj8x7pZ3zV81/akF1hdD+qw/JU58l9cY4 34RnNnxoxninK1/+r4wwtREUO0rxQQt9zlTgfFphOKW3cFcmqH+XyBBmbmLA551KYBv6 smmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Kt42L0QvLOhsvlBZEq7U6NFD+niXRDzZ9fK01ux3nlI=; b=hlcnmFTiPRbW0UevAKHC0axwg8yc2D+el/ca1r+EO9FMGjFxcS8VkzlPweBrORuRUL 2PRp78kuD6s4jm69MZn8JcncetWSsbl4YOb2CJnyEaoQ54Mshy6S9FGaMqn9XRDOADDA reaJAlO9oDMd6hG4pK5Jgre6V73Ci/EaEZt9kO5vOMJVvew3rtal9AgunW9edwPO2509 L8/4nrRGFejrcKpKezidopKcwYVOAO4v9ifKzXMSY/DqU8f+b5uuqFSl8Nfpt98uV/Id RUjPA/+ghhFPCKXJdBIMaRuJREQ6EjPg34qwE85Nkl4h7zdymmPnWgOeAb4LlVFDL04F yqkA== X-Gm-Message-State: AOAM5320Y3rm5wsTaxHjlQBIy7+VHVNTtBHZa6QLnO2yr7mcd3nLCxwj w1DETJ4myqUc+UvgmEe7Rs5R8RrJYKg6Qg== X-Google-Smtp-Source: ABdhPJzAmAoUmlN6/YvP2iqmpL9ECuCkgigIFZNXn5oBiPiCN5MpkF2OLjO9zwzPNlxYqmYajLW9KA== X-Received: by 2002:ac8:7383:: with SMTP id t3mr21024783qtp.242.1614023481083; Mon, 22 Feb 2021 11:51:21 -0800 (PST) Received: from localhost.localdomain (dsl-154-25.b2b2c.ca. [66.158.154.25]) by smtp.gmail.com with ESMTPSA id e14sm11438619qte.18.2021.02.22.11.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Feb 2021 11:51:20 -0800 (PST) From: Maxim Cournoyer Date: Mon, 22 Feb 2021 14:50:06 -0500 Message-Id: <20210222195006.11357-4-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210222195006.11357-1-maxim.cournoyer@gmail.com> References: <87k1dbb260.fsf@gnu.org> <20210222195006.11357-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vagrant Cascadian , Maxim Cournoyer Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 2.73 Authentication-Results: aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=n80q9WvR; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx2.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 74130105B5 X-Spam-Score: 2.73 X-Migadu-Scanner: scn1.migadu.com X-TUID: cmmmnsIT8zLw Fixes . Before this change, the 'binfmt_misc' entries registered for QEMU would not be usable in container contexts outside of guix-daemon (without manually bind mounting file names). For example: $ docker run --rm arm32v7/debian true standard_init_linux.go:207: exec user process caused "no such file or directory" After this change, any container can make use of the QEMU binfmt_misc registrations, as their corresponding QEMU static binaries are fully pre-loaded by the kernel. * gnu/services/virtualization.scm (): Define using 'define-record-type*'. [flags]: New field, which defaults to "F" (fix binary). (%i386, %i486, %alpha, %arm, %armeb, %sparc, %sparc32plus, %ppc, %ppc64) (%ppc64le, %m68k, %mips, %mipsel, %mipsn32, %mipsn32el, %mips64, %mips64el) (%riscv32, %riscv64, %sh4, %sh4eb, %s390x, %aarch64, %hppa): Adjust. (qemu-binfmt-guix-chroot): Remove variable. (qemu-binfmt-service-type): Remove the qemu-binfmt-guix-chroot extension. * gnu/services/qemu-binfmt (qemu-platform->binfmt): Use the static output of QEMU. * doc/contributing.texi (Submitting Patches): Update doc. * doc/guix.texi (Virtualization Services): Update doc. --- doc/contributing.texi | 1 - doc/guix.texi | 12 -- gnu/services/virtualization.scm | 227 ++++++++++++++++++-------------- 3 files changed, 129 insertions(+), 111 deletions(-) diff --git a/doc/contributing.texi b/doc/contributing.texi index 3baedb0654..94fb22316d 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -1016,7 +1016,6 @@ your @code{operating-system} configuration: (service qemu-binfmt-service-type (qemu-binfmt-configuration (platforms (lookup-qemu-platforms "arm" "aarch64")) - (guix-support? #t))) @end lisp Then reconfigure your system. diff --git a/doc/guix.texi b/doc/guix.texi index 5f55853159..7a4340a1d9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -28645,13 +28645,6 @@ This is the configuration for the @code{qemu-binfmt} service. The list of emulated QEMU platforms. Each item must be a @dfn{platform object} as returned by @code{lookup-qemu-platforms} (see below). -@item @code{guix-support?} (default: @code{#t}) -When it is true, QEMU and all its dependencies are added to the build -environment of @command{guix-daemon} (@pxref{Invoking guix-daemon, -@option{--chroot-directory} option}). This allows the @code{binfmt_misc} -handlers to be used within the build environment, which in turn means -that you can transparently build programs for another architecture. - For example, let's suppose you're on an x86_64 machine and you have this service: @@ -28659,7 +28652,6 @@ service: (service qemu-binfmt-service-type (qemu-binfmt-configuration (platforms (lookup-qemu-platforms "arm")) - (guix-support? #t))) @end lisp You can run: @@ -28674,10 +28666,6 @@ build}, transparently using QEMU to emulate the ARMv7 CPU@. Pretty handy if you'd like to test a package build for an architecture you don't have access to! -When @code{guix-support?} is set to @code{#f}, programs for other -architectures can still be executed transparently, but invoking commands -like @command{guix build -s armhf-linux @dots{}} will fail. - @item @code{qemu} (default: @code{qemu}) The QEMU package to use. @end table diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm index a45da14a80..36e9feb05c 100644 --- a/gnu/services/virtualization.scm +++ b/gnu/services/virtualization.scm @@ -554,13 +554,14 @@ potential infinite waits blocking libvirt.")) ;;; ;; Platforms that QEMU can emulate. -(define-record-type - (qemu-platform name family magic mask) +(define-record-type* + qemu-platform make-qemu-platform qemu-platform? (name qemu-platform-name) ;string (family qemu-platform-family) ;string (magic qemu-platform-magic) ;bytevector - (mask qemu-platform-mask)) ;bytevector + (mask qemu-platform-mask) ;bytevector + (flags qemu-platform-flags (default "F"))) ;string (define-syntax bv (lambda (s) @@ -577,125 +578,173 @@ potential infinite waits blocking libvirt.")) ;;; 'scripts/qemu-binfmt-conf.sh' in QEMU. (define %i386 - (qemu-platform "i386" "i386" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00") - (bv "\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "i386") + (family "i386") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %i486 - (qemu-platform "i486" "i386" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00") - (bv "\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "i486") + (family "i386") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %alpha - (qemu-platform "alpha" "alpha" - (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90") - (bv "\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "alpha") + (family "alpha") + (magic (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90")) + (mask (bv "\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %arm - (qemu-platform "arm" "arm" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "arm") + (family "arm") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %armeb - (qemu-platform "armeb" "arm" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "armeb") + (family "arm") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %sparc - (qemu-platform "sparc" "sparc" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02") - (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "sparc") + (family "sparc") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %sparc32plus - (qemu-platform "sparc32plus" "sparc" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12") - (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "sparc32plus") + (family "sparc") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %ppc - (qemu-platform "ppc" "ppc" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "ppc") + (family "ppc") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %ppc64 - (qemu-platform "ppc64" "ppc" - (bv "\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "ppc64") + (family "ppc") + (magic (bv "\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %ppc64le - (qemu-platform "ppc64le" "ppcle" - (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00"))) + (qemu-platform + (name "ppc64le") + (family "ppcle") + (magic (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00")))) (define %m68k - (qemu-platform "m68k" "m68k" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04") - (bv "\xff\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "m68k") + (family "m68k") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) ;; XXX: We could use the other endianness on a MIPS host. (define %mips - (qemu-platform "mips" "mips" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "mips") + (family "mips") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %mipsel - (qemu-platform "mipsel" "mips" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "mipsel") + (family "mips") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %mipsn32 - (qemu-platform "mipsn32" "mips" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "mipsn32") + (family "mips") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %mipsn32el - (qemu-platform "mipsn32el" "mips" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "mipsn32el") + (family "mips") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %mips64 - (qemu-platform "mips64" "mips" - (bv "\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "mips64") + (family "mips") + (magic (bv "\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %mips64el - (qemu-platform "mips64el" "mips" - (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "mips64el") + (family "mips") + (magic (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %riscv32 - (qemu-platform "riscv32" "riscv" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "riscv32") + (family "riscv") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %riscv64 - (qemu-platform "riscv64" "riscv" - (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "riscv64") + (family "riscv") + (magic (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %sh4 - (qemu-platform "sh4" "sh4" - (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "sh4") + (family "sh4") + (magic (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %sh4eb - (qemu-platform "sh4eb" "sh4" - (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a") - (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "sh4eb") + (family "sh4") + (magic (bv "\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %s390x - (qemu-platform "s390x" "s390x" - (bv "\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16") - (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "s390x") + (family "s390x") + (magic (bv "\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %aarch64 - (qemu-platform "aarch64" "arm" - (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff"))) + (qemu-platform + (name "aarch64") + (family "arm") + (magic (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))) (define %hppa - (qemu-platform "hppa" "hppa" - (bv "\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f") - (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff"))) + (qemu-platform + (name "hppa") + (family "hppa") + (magic (bv "\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f")) + (mask (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff")))) (define %qemu-platforms (list %i386 %i486 %alpha %arm %sparc32plus %ppc %ppc64 %ppc64le %m68k @@ -715,9 +764,7 @@ potential infinite waits blocking libvirt.")) (qemu qemu-binfmt-configuration-qemu (default qemu)) (platforms qemu-binfmt-configuration-platforms - (default '())) ;safest default - (guix-support? qemu-binfmt-configuration-guix-support? - (default #t))) + (default '()))) ;safest default (define (qemu-platform->binfmt qemu platform) "Return a gexp that evaluates to a binfmt string for PLATFORM, using the @@ -733,14 +780,13 @@ given QEMU package." (bytevector->u8-list bv)))) (match platform - (($ name family magic mask) + (($ name family magic mask flags) ;; See 'Documentation/binfmt_misc.txt' in the kernel. #~(string-append ":qemu-" #$name ":M::" #$(bytevector->binfmt-string magic) ":" #$(bytevector->binfmt-string mask) - ":" #$(file-append qemu "/bin/qemu-" name) - ":" ;FLAGS go here - )))) + ":" #$qemu:static "/bin/qemu-" #$name + ":" #$flags)))) (define %binfmt-mount-point (file-system-mount-point %binary-format-file-system)) @@ -779,19 +825,6 @@ given QEMU package." '#$(map qemu-platform-name platforms)) #f))))))) -(define qemu-binfmt-guix-chroot - (match-lambda - ;; Add QEMU and its dependencies to the guix-daemon chroot so that our - ;; binfmt_misc handlers work in the chroot (otherwise 'execve' would fail - ;; with ENOENT.) - ;; - ;; The 'F' flag of binfmt_misc is meant to address this problem by loading - ;; the interpreter upfront rather than lazily, but apparently that is - ;; insufficient (perhaps it loads the 'qemu-ARCH' binary upfront but looks - ;; up its dependencies lazily?). - (($ qemu platforms guix?) - (if guix? (list qemu) '())))) - (define qemu-binfmt-service-type ;; TODO: Make a separate binfmt_misc service out of this? (service-type (name 'qemu-binfmt) @@ -800,9 +833,7 @@ given QEMU package." (const (list %binary-format-file-system))) (service-extension shepherd-root-service-type - qemu-binfmt-shepherd-services) - (service-extension guix-service-type - qemu-binfmt-guix-chroot))) + qemu-binfmt-shepherd-services))) (default-value (qemu-binfmt-configuration)) (description "This service supports transparent emulation of binaries -- 2.30.1