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 /uLpG+0LD2NpwAAAbAwnHQ (envelope-from ) for ; Wed, 31 Aug 2022 09:21:17 +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 eJLvGe0LD2MBLAAAG6o9tA (envelope-from ) for ; Wed, 31 Aug 2022 09:21:17 +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 EA5A3FE19 for ; Wed, 31 Aug 2022 09:21:16 +0200 (CEST) Received: from localhost ([::1]:38186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTI2G-0000lg-1X for larch@yhetil.org; Wed, 31 Aug 2022 03:21:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTI15-0000lQ-1E for guix-patches@gnu.org; Wed, 31 Aug 2022 03:20:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48337) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTI14-00041s-Om for guix-patches@gnu.org; Wed, 31 Aug 2022 03:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTI14-00036t-Gf for guix-patches@gnu.org; Wed, 31 Aug 2022 03:20:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH 1/2] gnu: bootloader: Extend `' for chain-loader. Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 31 Aug 2022 07:20: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, typ22@foxmail.com Cc: tiantian X-Debbugs-Original-To: guix-patches@gnu.org, typ22@foxmail.com, 57496@debbugs.gnu.org Received: via spool by 57496-submit@debbugs.gnu.org id=B57496.166193038611928 (code B ref 57496); Wed, 31 Aug 2022 07:20:02 +0000 Received: (at 57496) by debbugs.gnu.org; 31 Aug 2022 07:19:46 +0000 Received: from localhost ([127.0.0.1]:38086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTI0n-00036J-M7 for submit@debbugs.gnu.org; Wed, 31 Aug 2022 03:19:46 -0400 Received: from lepiller.eu ([89.234.186.109]:53242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTI0k-000369-V7 for 57496@debbugs.gnu.org; Wed, 31 Aug 2022 03:19:44 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 0705ca46; Wed, 31 Aug 2022 07:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:in-reply-to:references:message-id:mime-version :content-type:content-transfer-encoding; s=dkim; bh=HzY+Zjj9x0sM sy08oL9PxweeDDBLaKZAijexVGVXNPg=; b=ONHTbxoSfYPh9pK2yWYLk9kFuFme VVzX0gC+DIgYM0a47v1FGutp6L5RxRgKH9TVHH3GEJ1Tqp6Mqw2j2BsF8ZCvO619 JvFZpI5gk34hNRgiuwv6UguNywN1USqB8adxHcaXOWfMiX9stUBJE/oe45mDQdpD H+sZM6SfNQOQ6ePgXFruwjzp5tNibfWf/808bd6CpzNBqBbHaX/1z5XyfCkCQmn8 xWqb/HqUe5tCRIi6uEdBhQlsuJiK35PAw0jyBUST2vk5auhR7jfR18NjHk/sGi0Y 7JWFGcO1orQxVXCrSncg3E2p10kf6VpvfQxcQSSxfiUYDNGmZxO/dQxEjQ== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 0b11d695 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 31 Aug 2022 07:18:55 +0000 (UTC) Date: Wed, 31 Aug 2022 09:18:44 +0200 From: Julien Lepiller User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <9C7742D4-1097-46B1-BE10-19069D14B0A5@lepiller.eu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----4UEM5TVXXD88THP6UYK2I3663N93C1 Content-Transfer-Encoding: 7bit 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=1661930477; 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: 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=KgBzM8oApieZENYTNEFBIGdhq7XUHXtvJmUSwOp0jsI=; b=CwBJ2sQl04UVNGeNIIH8dZPyvzrC9pt/hyNfqbMlbJiYVvQ3XMZT7gZXrEwndxpq8a+pGe YbrVZkzwaDsDhFmQXWrbtRXnDbnQljRY2Ty0sR97ZL1wiypWYuv1IT8RXlpcPkvYsQSfVN GIqnlHxFMGs0E5TUqtaCWPWuvU87ForETc2Xg/1Ysj+te/QGQ2vnvviSLnKxOPmxsME7Ae kDtMbOo2PJcPSUpnA/Cwi/4X5iXqyKcN5j5JKuExP97QmdXDiyWK9owjNMLDYlErpJd+cD 29XDTYXg88ezo1FG86jzj0YYDA4MPdpD9jb+Tuv9ikMsNCsXJxGSz6y4wbd6wQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661930477; a=rsa-sha256; cv=none; b=Oc4s4v+9yOwydBFvut77+N6AOfwHcrRz2u5ZrtwPw026Ue3ySjJQH804GI196VB+lQmBrV H/Pap1fIr3T/qEMu69iCPdMRncJ1kMHvT1CmNSCwo6UDXqhPGajn/H2hEdQ2Ja6wyx4j/M KMF+n3KfGrkAxkmKvoZSbdU+lrbWlQ4LXjNWoR/A5NVKv5jjI/cgNjmP4Q+TbS6Dg0PiPQ KMdutbPgKezICBoLOdbdbBj0Lmr/YLMCcaDl1N00oEHDU09enTkbSwCt0uK+xr++l5wwpi T+/HsUz61U6aU4jBPMOKIj4aTwj74qXtOtKKSmcYXmH0to8cL5pD4DeRWQVOOw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=ONHTbxoS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (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: 7.71 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=ONHTbxoS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (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: EA5A3FE19 X-Spam-Score: 7.71 X-Migadu-Scanner: scn1.migadu.com X-TUID: POoWmDpILU4E ------4UEM5TVXXD88THP6UYK2I3663N93C1 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi tiantian! Thanks for the patches=2E It's a bit hard to follow since I'm not at a com= puter, but here are some preliminary remarks=2E First, thanks for documenting the change in the manual, it's not something= even I think about all the time ^^'=2E We'll have to rework the English a = bit but it's understandable :) I'm wondering why there are two patches? The first patch below seems docum= ented but the second patch does not have a changelog text=2E Shouldn't they= be merged? They seem to be for the same thing=2E From=20what I understand, specifying chainloader with at least linux or linu= x-multiboot will lead to chainloader being silently dropped=2E Maybe we sho= uld have an error message instead? I'm not too familiar with chainloading=2E Is using grub partition names li= ke (hd0,gpt1) the only way? We try to discourage using these names as they = can easily vary between reboots and your system unbootable=2E Otherwise, it looks fine at first glance, but untested :) Le 31 ao=C3=BBt 2022 07:27:48 GMT+02:00, typ22@foxmail=2Ecom a =C3=A9crit= =C2=A0: >From: tiantian > >* gnu/bootloader=2Escm ()[chain-loader]: New field=2E >(menu-entry->sexp, sexp->menu-entry): Support chain-loader=2E >* doc/guix=2Etexi (Bootloader Configuration): Document it=2E >--- > doc/guix=2Etexi | 15 +++++++++++++++ > gnu/bootloader=2Escm | 40 ++++++++++++++++++++++++++++++++++------ > 2 files changed, 49 insertions(+), 6 deletions(-) > >diff --git a/doc/guix=2Etexi b/doc/guix=2Etexi >index 957b9a668e=2E=2E69dcd9e7b9 100644 >--- a/doc/guix=2Etexi >+++ b/doc/guix=2Etexi >@@ -37536,6 +37536,21 @@ Bootloader Configuration > @dots{})) > @end lisp >=20 >+@item @code{chain-loader} (default: @code{#f}) >+A string that any accepted by @code{chainloader}=2E If there are items >+other than @code{label} and @code{device}, it will have no effect=2E >+ >+@lisp >+(bootloader >+ (bootloader-configuration >+ ;; @dots{} >+ (menu-entries >+ (list >+ (menu-entry >+ (label "GNU/Linux") >+ (chain-loader "(hd0,gpt1)/EFI/GNULinux/grubx64=2Eefi")))))) >+@end lisp >+ > @end table > @end deftp >=20 >diff --git a/gnu/bootloader=2Escm b/gnu/bootloader=2Escm >index 77c05e8946=2E=2E41f690a4dc 100644 >--- a/gnu/bootloader=2Escm >+++ b/gnu/bootloader=2Escm >@@ -46,6 +46,7 @@ (define-module (gnu bootloader) > menu-entry-multiboot-kernel > menu-entry-multiboot-arguments > menu-entry-multiboot-modules >+ menu-entry-chain-loader >=20 > menu-entry->sexp > sexp->menu-entry >@@ -104,8 +105,11 @@ (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 >+ >=20 > (define (menu-entry->sexp entry) > "Return ENTRY serialized as an sexp=2E" >@@ -117,8 +121,15 @@ (define (menu-entry->sexp entry) > `(label ,(file-system-label->string label))) > (_ device))) > (match entry >- (($ label device mount-point linux linux-arguments init= rd #f >- ()) >+ ;; Fields of in the patterns is incomplete, >+ ;; resulting in menu-entry with chain-loader incorrectly >+ ;; matching the first=2E >+ ;; To keep pattern is short and keep matching order, >+ ;; judge an important field in each pattern=2E >+ ;; Such as kernel=2E >+ (($ label device mount-point >+ (? identity linux) linux-arguments initrd >+ #f ()) > `(menu-entry (version 0) > (label ,label) > (device ,(device->sexp device)) >@@ -127,14 +138,22 @@ (define (menu-entry->sexp entry) > (linux-arguments ,linux-arguments) > (initrd ,initrd))) > (($ label device mount-point #f () #f >- multiboot-kernel multiboot-arguments multiboot-modu= les) >+ (? identity multiboot-kernel) multiboot-arguments >+ multiboot-modules) > `(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))))) >=20 > (define (sexp->menu-entry sexp) > "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a >@@ -171,7 +190,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) _ =2E=2E=2E) >+ (menu-entry >+ (label label) >+ (device (sexp->device device)) >+ (device-mount-point mount-point) >+ (chain-loader chain-loader))))) >=20 > =0C> > ;;; >--=20 >2=2E37=2E2 > > > > ------4UEM5TVXXD88THP6UYK2I3663N93C1 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi tiantian!

Thanks for the patches=2E It's= a bit hard to follow since I'm not at a computer, but here are some prelim= inary remarks=2E

First, thanks for documenting the change in the man= ual, it's not something even I think about all the time ^^'=2E We'll have t= o rework the English a bit but it's understandable :)

I'm wondering = why there are two patches? The first patch below seems documented but the s= econd patch does not have a changelog text=2E Shouldn't they be merged? The= y seem to be for the same thing=2E

From what I understand, specifyin= g chainloader with at least linux or linux-multiboot will lead to chainload= er being silently dropped=2E Maybe we should have an error message instead?=

I'm not too familiar with chainloading=2E Is using grub partition n= ames like (hd0,gpt1) the only way? We try to discourage using these names a= s they can easily vary between reboots and your system unbootable=2E
Otherwise, it looks fine at first glance, but untested :)

Le 31 ao=C3=BBt 2022 07:27:48 GMT+02:00, typ22@foxmail=2E= com a =C3=A9crit=C2=A0:
From: tiantian <typ22@foxmail=2Ecom&=
gt;

* gnu/bootloader=2Escm (<menu-entry>)[chain-loader]: New f= ield=2E
(menu-entry->sexp, sexp->menu-entry): Support chain-loader= =2E
* doc/guix=2Etexi (Bootloader Configuration): Document it=2E
doc= /guix=2Etexi | 15 +++++++++++++++
gnu/bootloader=2Escm | 40 ++++++= ++++++++++++++++++++++++++++------
2 files changed, 49 insertions(+), 6= deletions(-)

diff --git a/doc/guix=2Etexi b/doc/guix=2Etexi
inde= x 957b9a668e=2E=2E69dcd9e7b9 100644
--- a/doc/guix=2Etexi
+++ b/doc/g= uix=2Etexi
@@ -37536,6 +37536,21 @@ Bootloader Configuration
= @dots{}))
@end lisp

+@item @code{chain-loader} (default: = @code{#f})
+A string that any accepted by @code{chainloader}=2E If there= are items
+other than @code{label} and @code{device}, it will have no e= ffect=2E
+
+@lisp
+(bootloader
+ (bootloader-configuration
= + ;; @dots{}
+ (menu-entries
+ (list
+ (menu-entry=
+ (label "GNU/Linux")
+ (chain-loader "(hd0,gpt1)/= EFI/GNULinux/grubx64=2Eefi"))))))
+@end lisp
+
@end table
@en= d deftp

diff --git a/gnu/bootloader=2Escm b/gnu/bootloader=2Escmindex 77c05e8946=2E=2E41f690a4dc 100644
--- a/gnu/bootloader=2Escm
+= ++ b/gnu/bootloader=2Escm
@@ -46,6 +46,7 @@ (define-module (gnu bootload= er)
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,11 @@ (define-record-type= * <menu-entry>
(multiboot-arguments menu-entry-multiboot-argume= nts
(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 &l= t;string>
+ (chain-loader menu-entry-chain-loader
+ = (default #f))) ; string, path of efi file
+

(= define (menu-entry->sexp entry)
"Return ENTRY serialized as an sex= p=2E"
@@ -117,8 +121,15 @@ (define (menu-entry->sexp entry)
= `(label ,(file-system-label->string label)))
(_ device))) (match entry
- (($ <menu-entry> label device mount-point li= nux linux-arguments initrd #f
- ())
+ ;; Field= s of <menu-entry> in the patterns is incomplete,
+ ;; resulting= in menu-entry with chain-loader incorrectly
+ ;; matching the first= =2E
+ ;; To keep pattern is short and keep matching order,
+ ;;= judge an important field in each pattern=2E
+ ;; Such as kernel=2E+ (($ <menu-entry> label device mount-point
+ = (? identity linux) linux-arguments initrd
+ #f = ())
`(menu-entry (version 0)
(label ,label)<= br> (device ,(device->sexp device))
@@ -127,14 +138= ,22 @@ (define (menu-entry->sexp entry)
(linux-arg= uments ,linux-arguments)
(initrd ,initrd)))
(= ($ <menu-entry> label device mount-point #f () #f
- = multiboot-kernel multiboot-arguments multiboot-modules)
+ = (? identity multiboot-kernel) multiboot-arguments
+ = multiboot-modules)
`(menu-entry (version 0)
= (label ,label)
(device ,(device->sexp = device))
(device-mount-point ,mount-point)
= (multiboot-kernel ,multiboot-kernel)
(mul= tiboot-arguments ,multiboot-arguments)
- (multiboot-mod= ules ,multiboot-modules)))))
+ (multiboot-modules ,mult= iboot-modules)))
+ (($ <menu-entry> 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-loade= r)))))

(define (sexp->menu-entry sexp)
"Turn SEXP, an sex= p as returned by 'menu-entry->sexp', into a <menu-entry>
@@ -17= 1,7 +190,16 @@ (define (sexp->menu-entry sexp)
(device-mount-p= oint mount-point)
(multiboot-kernel multiboot-kernel)
(= multiboot-arguments multiboot-arguments)
- (multiboot-modules multi= boot-modules)))))
+ (multiboot-modules multiboot-modules)))
+ = (('menu-entry ('version 0)
+ ('label label) ('device d= evice)
+ ('device-mount-point mount-point)
+ = ('chain-loader chain-loader) _ =2E=2E=2E)
+ (menu-entry+ (label label)
+ (device (sexp->device device))
+ = (device-mount-point mount-point)
+ (chain-loader chain-loader)))))=


;;;
--
2=2E37=2E= 2




------4UEM5TVXXD88THP6UYK2I3663N93C1--