From patchwork Sun Mar 31 21:02:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 62402 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BDAF727BBE2; Sun, 31 Mar 2024 22:04:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B714B27BBEB for ; Sun, 31 Mar 2024 22:04:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rr2LS-0005OJ-8a; Sun, 31 Mar 2024 17:04:02 -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 1rr2LP-0005NK-MR for guix-patches@gnu.org; Sun, 31 Mar 2024 17:03:59 -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 1rr2LP-0001Df-De for guix-patches@gnu.org; Sun, 31 Mar 2024 17:03:59 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rr2LR-0004I3-UH for guix-patches@gnu.org; Sun, 31 Mar 2024 17:04:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69899] [PATCH 0/7] support to use `guix system vm' with riscv64. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Mar 2024 21:04:01 +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: Zheng Junjie Cc: 69899@debbugs.gnu.org, Leo Famulari Received: via spool by 69899-submit@debbugs.gnu.org id=B69899.171191899316317 (code B ref 69899); Sun, 31 Mar 2024 21:04:01 +0000 Received: (at 69899) by debbugs.gnu.org; 31 Mar 2024 21:03:13 +0000 Received: from localhost ([127.0.0.1]:48669 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rr2Ke-0004F6-RY for submit@debbugs.gnu.org; Sun, 31 Mar 2024 17:03:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rr2Kc-0004Er-Cx for 69899@debbugs.gnu.org; Sun, 31 Mar 2024 17:03:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rr2KQ-0000Ze-GY; Sun, 31 Mar 2024 17:02:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=/CYaAXR0EMJdYlZoawXK3WUjkLyRucjOsXIdlNiaM5Y=; b=j627qe+cosXLIwxKXxtR lAeRc4ux3Ive75Aw41m4cyWnbbEiHyIB+CTAUgtjyMrAFlnIDAIAot0MrvXEPLgon0t6hzTOx4fzF qo6IH2eC0ofGpGTTUbYNvhLBZgcvhrveOY7f6qSIpie1teQaCZN51qlxnZzIA/1CewRssLIgfhW9j fE4U5bUQAZmIciGbaXUJCddVsMBh+F962ZfDBVeba4fCc/MxZEzxt0yDMuY+8Wn+r5jV4ZIAjkgt8 CBgF2iLZd6wrnKVggG5OBNE5YuaoZluGHGAr1jEc2/KWpDzR6Ag+VjAuxsQwTnw+PxlbtWgy6Yjmy yu0a50T3K9XP8Q==; From: Ludovic =?utf-8?q?Court=C3=A8s?= In-Reply-To: <87ttksgheo.fsf@iscas.ac.cn> (Zheng Junjie's message of "Wed, 27 Mar 2024 17:15:26 +0800") References: <87ttksgheo.fsf@iscas.ac.cn> Date: Sun, 31 Mar 2024 23:02:54 +0200 Message-ID: <877chidsht.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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=riscv64-linux-gnu' work. >>> and `guix system vm --system=riscv64-linux` also work, But there is a problem >>> that the qemu running with --system=riscv64-linux is also riscv architecture, >>> 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, ‘--system=X’ is supposed to be giving the exact same result as if you were building natively on X. Thus, it’s not surprising that ‘guix system vm --system=X’ gives on a QEMU binary built for X. Now, it’s admittedly not very useful in this case. I believe the attached patch implements #1 (I wasn’t able to test it yet because too many things had to be built). How does it sound? Thanks, Ludo’. 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))) (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 emulator. + (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?