From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4AR2LO/fFGMxqQAAbAwnHQ (envelope-from ) for ; Sun, 04 Sep 2022 19:27:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id ANqkK+/fFGONpAAAG6o9tA (envelope-from ) for ; Sun, 04 Sep 2022 19:27:11 +0200 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 51ED31160 for ; Sun, 4 Sep 2022 19:27:11 +0200 (CEST) Received: from localhost ([::1]:49920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUtOo-0008BT-Gy for larch@yhetil.org; Sun, 04 Sep 2022 13:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUtOh-0008BI-05 for guix-patches@gnu.org; Sun, 04 Sep 2022 13:27:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUtOg-0004AW-OH for guix-patches@gnu.org; Sun, 04 Sep 2022 13:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUtOg-00079p-Db for guix-patches@gnu.org; Sun, 04 Sep 2022 13:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH v4 1/3] gnu: bootloader: Extend `' for chain-loader. References: In-Reply-To: Resent-From: typ22@foxmail.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Sep 2022 17:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57496 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57496@debbugs.gnu.org Cc: julien@lepiller.eu, tiantian Received: via spool by 57496-submit@debbugs.gnu.org id=B57496.166231241027495 (code B ref 57496); Sun, 04 Sep 2022 17:27:02 +0000 Received: (at 57496) by debbugs.gnu.org; 4 Sep 2022 17:26:50 +0000 Received: from localhost ([127.0.0.1]:45602 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUtOT-00079O-Lk for submit@debbugs.gnu.org; Sun, 04 Sep 2022 13:26:50 -0400 Received: from out162-62-57-87.mail.qq.com ([162.62.57.87]:44441) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUtOQ-000797-17 for 57496@debbugs.gnu.org; Sun, 04 Sep 2022 13:26:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1662312397; bh=Q9UgzfBzvnlqxDUpKL0g9usuB3muksaRoIJHLqKKqho=; h=From:To:Cc:Subject:Date; b=lPvzro+/oDbynFPBFpC4aEml797dTjmrUvZZziBG70x55l5xDFsk+WCZGOT2m9lst AeQBKP1MK+XwWd4p170fy+OoHlVTYF7zMnkTYvwN/oyF3wIN2wJqP2A9R4Bd02QXhP vLgSvDhAwsQgzdW1C5Wr7w6wSawopTnLWURggj9s= Received: from localhost.localdomain ([240e:398:28a4:3121:5ae1:85dd:ab7b:103f]) by newxmesmtplogicsvrsza31.qq.com (NewEsmtp) with SMTP id 6A38201E; Mon, 05 Sep 2022 01:26:35 +0800 X-QQ-mid: xmsmtpt1662312395tkjfpur49 Message-ID: X-QQ-X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cfb55a05ecea2.1662308919.git.typ22@foxmail.com> X-Mailer: git-send-email 2.37.2 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: 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1662312431; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: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:dkim-signature; bh=fmkWuZAj+T7B41tCmXNzPRZU3IcD4HRrMGom+yr2x6g=; b=ZqB8nVa8lLX/ANS0cF9hQ57mpDC8iEzDHyo0UcjLyMtRFgoHGXvrJsPU82kY9eLdCBZX9W IiX/RbiUX3dEUk+Y6jZk26Vu7T/tAkkG0OyvMp1piKd6uzrmD18N8RLvATXQ6gUGNQpKTi h6pXBUccC4JbUtVk0/1uTfc5b6ucaTDeRvtEQGfAM4R7kQero9wlBdYEH6GTPcsk6eacpz lKa+lqDt20jwns5wil8IQ0lqr8RAXhF7Rl4vaoSBZajQWllOkwpl95VEb+XOxxXZx7LMtp 2Qy6XiKSB2QExok4kMRkxAFve+YS0rUheyLcHQauPMvixMH4YCX4qOvdRens7Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662312431; a=rsa-sha256; cv=none; b=f5b/DsQsnyHtUUp5usS5pSAnEswCfCytoJFH6qO46SD3uiWcPAA8aPsCGXvaA1UwlNqS57 OtUsH8wlqafVV7y6EYEwkY/X8ACYJeS91F6IEW1C7fplKSi8z9RZ8odlWhjACTo8SD6Nb4 FRZIGlEGYgvV2uSW3AmFwrUV15DYMYPFPDx1nb0b2JIHJ2h+YAWwLvFdo3zsEXXST04usu gBrf10TU5TqjyaRU4JfoOx6pBaoeTjgW1nrrJ48hc5hnHZT0070rcSEpOFJbxr/2a4YwrP d2gEY/2CZGrW9szH6Dbhk3cEqDBzMtXOAlEsmgFwXTeF6E4jxkinekXTCbSihg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=foxmail.com header.s=s201512 header.b="lPvzro+/"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=foxmail.com (policy=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" X-Migadu-Spam-Score: 5.82 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=foxmail.com header.s=s201512 header.b="lPvzro+/"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=foxmail.com (policy=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" X-Migadu-Queue-Id: 51ED31160 X-Spam-Score: 5.82 X-Migadu-Scanner: scn0.migadu.com X-TUID: p/qCmjj2MQtI From: tiantian * gnu/bootloader.scm ()[chain-loader]: New field. (menu-entry->sexp, sexp->menu-entry): Support chain-loader. * doc/guix.texi (Bootloader Configuration): Document it. Co-Authored-By: Julien Lepiller --- v2: Correct the document and specify all fields of in the pattern of menu-entry->sexp. Now still judge linux, multiboot-kernel and chain-loader. Because if don't judge, the menu-entry that all of linux, linux-multiboot and chainloader are #f will match the first one. Then produce Error message: guix system: error: #: invalid G-expression input This error message does not help. v3: correct the document and delete an extra blank line. v4: Add check for initrd in menu-entry->sexp, which is a change moved from the third patch of v3. all: The documents are mainly corrected by Julien Lepiller. Thank you here. doc/guix.texi | 18 ++++++++++++++++++ gnu/bootloader.scm | 33 +++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 957b9a668e..cc64a7ed70 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37536,6 +37536,24 @@ Bootloader Configuration @dots{})) @end lisp +@item @code{chain-loader} (default: @code{#f}) +A string that can be accepted by @code{grub}'s @code{chainloader} +directive. This has no effect if either @code{linux} or +@code{multiboot-kernel} fields are specified. The following is an +example of chainloading a different GNU/Linux system. + +@lisp +(bootloader + (bootloader-configuration + ;; @dots{} + (menu-entries + (list + (menu-entry + (label "GNU/Linux") + (device (uuid "1C31-A17C" 'fat)) + (chain-loader "/EFI/GNULinux/grubx64.efi")))))) +@end lisp + @end table @end deftp diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 77c05e8946..9fe6b65212 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -46,6 +46,7 @@ (define-module (gnu bootloader) menu-entry-multiboot-kernel menu-entry-multiboot-arguments menu-entry-multiboot-modules + menu-entry-chain-loader menu-entry->sexp sexp->menu-entry @@ -104,8 +105,10 @@ (define-record-type* (multiboot-arguments menu-entry-multiboot-arguments (default '())) ; list of string-valued gexps (multiboot-modules menu-entry-multiboot-modules - (default '()))) ; list of multiboot commands, where + (default '())) ; list of multiboot commands, where ; a command is a list of + (chain-loader menu-entry-chain-loader + (default #f))) ; string, path of efi file (define (menu-entry->sexp entry) "Return ENTRY serialized as an sexp." @@ -117,8 +120,9 @@ (define (menu-entry->sexp entry) `(label ,(file-system-label->string label))) (_ device))) (match entry - (($ label device mount-point linux linux-arguments initrd #f - ()) + (($ label device mount-point + (? identity linux) linux-arguments (? identity initrd) + #f () () #f) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) @@ -127,14 +131,22 @@ (define (menu-entry->sexp entry) (linux-arguments ,linux-arguments) (initrd ,initrd))) (($ label device mount-point #f () #f - multiboot-kernel multiboot-arguments multiboot-modules) + (? identity multiboot-kernel) multiboot-arguments + multiboot-modules #f) `(menu-entry (version 0) (label ,label) (device ,(device->sexp device)) (device-mount-point ,mount-point) (multiboot-kernel ,multiboot-kernel) (multiboot-arguments ,multiboot-arguments) - (multiboot-modules ,multiboot-modules))))) + (multiboot-modules ,multiboot-modules))) + (($ label device mount-point #f () #f #f () () + (? identity chain-loader)) + `(menu-entry (version 0) + (label ,label) + (device ,(device->sexp device)) + (device-mount-point ,mount-point) + (chain-loader ,chain-loader))))) (define (sexp->menu-entry sexp) "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a @@ -171,7 +183,16 @@ (define (sexp->menu-entry sexp) (device-mount-point mount-point) (multiboot-kernel multiboot-kernel) (multiboot-arguments multiboot-arguments) - (multiboot-modules multiboot-modules))))) + (multiboot-modules multiboot-modules))) + (('menu-entry ('version 0) + ('label label) ('device device) + ('device-mount-point mount-point) + ('chain-loader chain-loader) _ ...) + (menu-entry + (label label) + (device (sexp->device device)) + (device-mount-point mount-point) + (chain-loader chain-loader))))) ;;; base-commit: 6beadc82df204f315d06ea35f2e232bb32f8e440 -- 2.37.2