From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id IOEeK1cnDGat4AAAe85BDQ:P1 (envelope-from ) for ; Tue, 02 Apr 2024 17:42:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id IOEeK1cnDGat4AAAe85BDQ (envelope-from ) for ; Tue, 02 Apr 2024 17:42:15 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1712072535; a=rsa-sha256; cv=none; b=c7aWsKXf0bCd/9lMpnIibpXjypw6zNuwYNCxNkh+n7FUOsQrnOyk88yHsvcNb4zoKRVqvx z5XFfIRlcR3lZ6oovLuCOMDJTNfQ8N59Edv2WYYWZB8W5wJTIc/Ges1lIRY3fUY1nHdrpy IZvdQq/TXm6fsg+vJLbQHn7oZ4n7RUBMGKpTmyBZw9vQ1Gi9beqfTexNkrM+eXNYZphIvQ jvQA2m8DZ5sPA4nzQKfBZrWdAqLsXGKbv2Zx1gYeYx5YKiqWSU4kHQgFQUFA/vK6x3S2wz el7AmSFecFZIjratMSPJAMxHTXYqIQmawlyNPjU8/RvoH5couGUxL+NUAdSu8w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1712072535; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post; bh=oWtfCBB5JKSt8qhqSmmcWvNT5IR/V2mrNRrh5vlmdVw=; b=ejJvB+zwYUk/YKsdUuoKM6RSr5A4SAHeO3fy+YBIvTx+GpiSzK2hN0xYAeV6w4BeBEasnZ ZbdDm7f4Eb9rOOzs1/Z6PV+BlkIbD5vJB7s4Q9Rsh5Qd9KLsfe9wyICcrU82lZHNN7jKq7 spfJ/yue5c+yECvO65UU9V5XC1N68mLe7dvA30Harhvo+gYnmCgpnfBEuQHkLLFQWXk0Ja iEVRRRw5JV3ElBn0xFrpVZEY4EMm7JQfjLbb7A5A/aoA+wbji38DfxZVmukQbQPBytFqsc DZiPvBUAjd1Rrv9USPmTqndi1Npq1z64aSEAO4RqGFlLue8MsQITy5kPghJ4fA== 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 0CFD624D51 for ; Tue, 2 Apr 2024 17:42:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rrgH1-0004ZI-9p; Tue, 02 Apr 2024 11:42:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrgGv-0004Yu-AE for guix-patches@gnu.org; Tue, 02 Apr 2024 11:42:01 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rrgGs-0000ty-Nc for guix-patches@gnu.org; Tue, 02 Apr 2024 11:42:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rrgGw-0001HH-Fr for guix-patches@gnu.org; Tue, 02 Apr 2024 11:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69899] [PATCH 0/7] support to use `guix system vm' with riscv64. Resent-From: Zheng Junjie Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 02 Apr 2024 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69899 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 69899@debbugs.gnu.org, Leo Famulari Received: via spool by 69899-submit@debbugs.gnu.org id=B69899.17120724684681 (code B ref 69899); Tue, 02 Apr 2024 15:42:02 +0000 Received: (at 69899) by debbugs.gnu.org; 2 Apr 2024 15:41:08 +0000 Received: from localhost ([127.0.0.1]:55027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrgG4-0001DR-9q for submit@debbugs.gnu.org; Tue, 02 Apr 2024 11:41:08 -0400 Received: from smtp81.cstnet.cn ([159.226.251.81]:39484 helo=cstnet.cn) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrgFz-0001C7-MS for 69899@debbugs.gnu.org; Tue, 02 Apr 2024 11:41:06 -0400 Received: from m (unknown [111.0.51.68]) by APP-03 (Coremail) with SMTP id rQCowADnCCb+JgxmeS0BAQ--.25712S2; Tue, 02 Apr 2024 23:40:48 +0800 (CST) References: <87ttksgheo.fsf@iscas.ac.cn> <877chidsht.fsf@gnu.org> User-agent: mu4e 1.10.8; emacs 30.0.50 From: Zheng Junjie Date: Tue, 02 Apr 2024 01:20:12 +0800 In-reply-to: <877chidsht.fsf@gnu.org> Message-ID: <87zfub3h8l.fsf@iscas.ac.cn> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-CM-TRANSID: rQCowADnCCb+JgxmeS0BAQ--.25712S2 X-Coremail-Antispam: 1UD129KBjvJXoW7WrWfWryrtr1DCrWkKF17KFg_yoW8Xw4UpF 4SgF42kF4DGrySyrnFgr17ZFyxtrWjkw13WFykA3yrG3s09rnFvrnayF48Cr98Gr1Fg3W2 yFyjva43Xa4DA3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvFb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vE77IFxV W8XVW5AwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE 14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r1j6r4UM28EF7xvwVC2z280aV AFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x0 82IY62kv0487M2AExVA0xI801c8C04v7Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7 IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4U M4x0Y48IcVAKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I 0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWU XVWUAwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcV CY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAF wI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvj xUgg_TUUUUU X-Originating-IP: [111.0.51.68] X-CM-SenderInfo: x2kh0wxmxqyx3h6l2u1dvotugofq/ 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -8.45 X-Migadu-Queue-Id: 0CFD624D51 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -8.45 X-TUID: k6Ty1md+QlqD --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi, > > Zheng Junjie skribis: > >> Leo Famulari writes: >> >>> Hi, thanks for these patches! >>> >>> On Tue, Mar 19, 2024 at 11:15:53PM +0800, Zheng Junjie wrote: >>>> hello!. this patchset make `guix system vm --target=3Driscv64-linux-gn= u' work. >>>> and `guix system vm --system=3Driscv64-linux` also work, But there is = a problem >>>> that the qemu running with --system=3Driscv64-linux is also riscv arch= itecture, >>>> now you have to manually modify to use native qemu or the guix of qemu= -system >>>> on qemu-user is too slow. and must enable qemu-binfmt. >>> >>> So, what should we do about the problem? What's the ideal solution for >>> Guix? I don't have any experience with this subject matter. >> >> I've come up with two ideas: >> >> 1. Force the current system's qemu to be used, on x86_64 and -s >> riscv64-linux, use x86_64's qemu. >> 2. add an environment variable, GUIX_QEMU, to allow the internal qemu >> execution to be replaced >> >> There may be other solutions, but I can't think of them yet. > > Thing is, =E2=80=98--system=3DX=E2=80=99 is supposed to be giving the exa= ct same result as > if you were building natively on X. Thus, it=E2=80=99s not surprising th= at > =E2=80=98guix system vm --system=3DX=E2=80=99 gives on a QEMU binary buil= t for X. > > Now, it=E2=80=99s admittedly not very useful in this case. I believe the > attached patch implements #1 (I wasn=E2=80=99t able to test it yet becaus= e too > many things had to be built). How does it sound? it works, and the following patch is required. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-vm-Don-t-add-enable-kvm-when-SYSTEM-and-system-are-n.patch Content-Transfer-Encoding: quoted-printable From=20e178de931859399abdd4bd3300b7ce7c5593a6e3 Mon Sep 17 00:00:00 2001 Message-ID: From: Zheng Junjie Date: Tue, 2 Apr 2024 00:59:54 +0800 Subject: [PATCH] vm: Don't add -enable-kvm when SYSTEM and %system are not same. * gnu/system/vm.scm (common-qemu-options): Don't add -enable-kvm when SYSTEM and %system are not same. Change-Id: Ie6c602b297c39423a693fdc26bed1627266e5911 =2D-- gnu/system/vm.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index a2743453e7..42e9a08722 100644 =2D-- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -212,7 +212,8 @@ (define* (virtualized-operating-system os (define* (common-qemu-options image shared-fs #:key rw-image? =2D (target (%current-target-system))) + (target (%current-target-system)) + (system (%current-system))) "Return the a string-value gexp with the common QEMU options to boot IMA= GE, with '-virtfs' options for the host file systems listed in SHARED-FS." =20 @@ -223,7 +224,9 @@ (define* (common-qemu-options image shared-fs #~(;; Only enable kvm if we see /dev/kvm exists. ;; This allows users without hardware virtualization to still use the= se ;; commands. =2D #$@(if (and (not target) (file-exists? "/dev/kvm")) + #$@(if (and (not target) + (string=3D? system %system) + (file-exists? "/dev/kvm")) '("-enable-kvm") '()) =20 @@ -308,7 +311,8 @@ (define* (system-qemu-image/shared-store-script os (map file-system-mapping-source (cons %store-mapping mappings)) #:rw-image? (not volatile?) =2D #:target target) + #:target target + #:system system) "-m " (number->string #$memory-size) #$@options)) =20 base-commit: 9e9ec741d0dc5ce58f8d21d31800ff2cafce128f prerequisite-patch-id: 6183d199c58355eea1a85e1f1fe51f2f5fe44f65 =2D-=20 2.41.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable And maybe shebang interpreter also need override %CURRENT-SYSTEM?[1] Even though when the Shebang interpreter cannot execute, the file will be interpreted and executed by the current shell. > > diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm > index 7d9d07ebb7..a2743453e7 100644 > --- a/gnu/system/vm.scm > +++ b/gnu/system/vm.scm > @@ -287,8 +287,11 @@ (define* (system-qemu-image/shared-store-script os > #~(format #f "/tmp/guix-image-~a" (basename #$base-image))) >=20=20 > (define qemu-exec > - #~(list #+(file-append qemu "/bin/" > - (qemu-command (or target system))) > + #~(list #+(with-parameters ((%current-system %system) > + (%current-target-system #f)) > + ;; Override %CURRENT-SYSTEM to always use a native emu= lator. > + (file-append qemu "/bin/" > + (qemu-command (or target system)))) > ;; Tells qemu to use the terminal it was started in for IO. > #$@(if graphic? '() #~("-nographic")) > #$@(if full-boot? > > > Thanks, > Ludo=E2=80=99. [1] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/vm.scm?h=3D9= e9ec741d0dc5ce58f8d21d31800ff2cafce128f#n328 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmYMJvoACgkQO1qpk+Gi 3/C23w/+KC2fwYpU3+FQ1LHIu/gi2aUcZR/FUn6qTbCZ6fhwaps6zYFQaQulhwxM SftFfDcZ0PuOA+stY+7nHKKvM8pshOA9nOTtifCeddFO++FZ0jcX2YqDBVSvcVnS ZWKgnPXj7ryq0ld8C5oqQMuF/NmEoGKZJPLHqfa64qtHbVzEjLcJ94d/MmhPofcY rT1FOlp0ozcQfBUntkOcs5aMUfDgbtN22ufVsCuLthTPXgKJgu5udKODN8g4qOE6 NHcJtN2uVqDII/7TQ9L4jw3Qp5N+WiU5fvitSviIMpWgBfBzrTOTymBHiDqeNzvv UMvWgQpxpsh7eiUrWGfHqgIR2IH1CTyo0k9qmYDcrDrmwMKIyZ5BNJgCjeMrVt8J 0nJ1TJXHmHafV9/tjHW0El6U0gtw/2mNCoBe+6Qz3hzejEgspmUqHY9zzuHpP6CE EtmA9SlrIt77mb8wcRdVk1xzboM+2CYb87ubL3okDpTZ5A4nAabb/knY629x1v/8 cmAPze2Xaoh/GsROaRyneX4wG6mHm43lZ/f18LDC9r3vBYw7ZJO3OZfjwRyxo5Is CgfHhV8esH99z37UC34FZEFpgtdWHa2Q9nirE/bP+0HegvdrgG06VtVjV5G+rQjf cO8r5Y0H/S5YHyzWopc6cOFw7OiQAWMBy/ibTlIRDyc1DO1NqwU= =BIfo -----END PGP SIGNATURE----- --==-=-=--