From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 4A4/J/PxDmPf8AAAbAwnHQ (envelope-from ) for ; Wed, 31 Aug 2022 07:30:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id iKEiJ/PxDmN21wAAauVa8A (envelope-from ) for ; Wed, 31 Aug 2022 07:30:27 +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 4EB39D81F for ; Wed, 31 Aug 2022 07:30:27 +0200 (CEST) Received: from localhost ([::1]:52596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTGJ0-0000bg-GT for larch@yhetil.org; Wed, 31 Aug 2022 01:30:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTGId-0000a7-0u for guix-patches@gnu.org; Wed, 31 Aug 2022 01:30:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48216) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTGIc-0005N2-OF for guix-patches@gnu.org; Wed, 31 Aug 2022 01:30:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTGIc-0004Oo-KL for guix-patches@gnu.org; Wed, 31 Aug 2022 01:30:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH 1/2] gnu: bootloader: Extend `' for chain-loader. Resent-From: typ22@foxmail.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 31 Aug 2022 05:30: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: tiantian Received: via spool by 57496-submit@debbugs.gnu.org id=B57496.166192376616823 (code B ref 57496); Wed, 31 Aug 2022 05:30:02 +0000 Received: (at 57496) by debbugs.gnu.org; 31 Aug 2022 05:29:26 +0000 Received: from localhost ([127.0.0.1]:37964 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTGI2-0004NC-8s for submit@debbugs.gnu.org; Wed, 31 Aug 2022 01:29:26 -0400 Received: from out203-205-251-53.mail.qq.com ([203.205.251.53]:44151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTGHy-0004Ml-On for 57496@debbugs.gnu.org; Wed, 31 Aug 2022 01:29:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1661923753; bh=YvBUoWlPOQpN6m/Zs0gmk08A/wr8imaac6gY2QgvJFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=pbLOFxGjw+msaB3gRNa8tuymN4+hVjBsw8lFQZ1IxWp1B4BiyTYpqijOaEnjVunpb +BCIKNy41zoXiONzpuKsRkJ30ysiURsk2LO6FATqNpACPOz09jYA4MksovKD9XVSJw yUjxPwx6GDdaAeQc0KcL4jbcflnx1BkiF+HFH4FY= Received: from localhost.localdomain ([240e:398:28aa:8901:2e5d:53be:47ef:3da]) by newxmesmtplogicsvrszc13.qq.com (NewEsmtp) with SMTP id 74C1A441; Wed, 31 Aug 2022 13:29:12 +0800 X-QQ-mid: xmsmtpt1661923752t6meqwzqw Message-ID: X-QQ-XMAILINFO: M0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9fdc39f94215d4d8226d2b42df.1661918557.git.typ22@foxmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: References: 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=1661923827; 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=iddO491xqJEtNJKGRbMv1M7JbTn9BsVwtUiBhyeRQMk=; b=st/uVqfm7BEstOciiQNYWwMIegB+frt6VuKuai8a6Z9wnID2fEWqjgy4zMnWutbAc4/9Iu YzAOBXeE/okCbkn2dm2NVrKfUjkoN/kRQPkkfs4tilLzO753+Xf16r2eGWaZFbY5UVHhVI ah5yGMvTult8YCZ37DZG3r1QD1fEsrPRg4lDcxOiipum09Nom9MFP0nGjQOcsBt9ZP9aZE j80yviSbUlynLZXIgWix5+vnUi/nh+ewkgmLunAelZiEps5ibmOgM6nbiZZF/uRnna+wcI OdAVOc3riBfiuihAHnK6HllTdwYRSTQFtG9RHzHQrXlR737xuhPb5HhE1NC3RQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661923827; a=rsa-sha256; cv=none; b=q7xSVVOi6rmtCfL8wmoyGjvseTXAYjGK4fs9b+90Rcqzl+NpXLyIUEW4vSDcUGHeQqZQnR HQYIUPNkd3BsIno149fdeC+ObvrYquoVarKrzs5yhVWD2ifvJZs2+nVA6i2CrRtU+3DzPM XvZNhNM4mE0QxDcgMKzRT22BG/wrvYIsVU3gufR2bVUcGd6Q4aFsod1K317N3j1HBs8NJO uJ2bX5fTFainxzhz3pZ4jLFeHH7iszvY9TC1vMF4dGq0ompEWeSwFuoLAU4Cnyq7iA0AN8 jOC3tePWnGcPNEaNCcpGqxTsDNNv4lTXKkMgwACK23T+s2FXHqFGIXo0zKBuvg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=foxmail.com header.s=s201512 header.b=pbLOFxGj; 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: 8.21 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=foxmail.com header.s=s201512 header.b=pbLOFxGj; 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: 4EB39D81F X-Spam-Score: 8.21 X-Migadu-Spam: Yes X-Migadu-Scanner: scn1.migadu.com X-TUID: r5HpSVx8aOyS 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. --- doc/guix.texi | 15 +++++++++++++++ gnu/bootloader.scm | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 957b9a668e..69dcd9e7b9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37536,6 +37536,21 @@ Bootloader Configuration @dots{})) @end lisp +@item @code{chain-loader} (default: @code{#f}) +A string that any accepted by @code{chainloader}. If there are items +other than @code{label} and @code{device}, it will have no effect. + +@lisp +(bootloader + (bootloader-configuration + ;; @dots{} + (menu-entries + (list + (menu-entry + (label "GNU/Linux") + (chain-loader "(hd0,gpt1)/EFI/GNULinux/grubx64.efi")))))) +@end lisp + @end table @end deftp diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 77c05e8946..41f690a4dc 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,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 + (define (menu-entry->sexp entry) "Return ENTRY serialized as an sexp." @@ -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 initrd #f - ()) + ;; Fields of in the patterns is incomplete, + ;; resulting in menu-entry with chain-loader incorrectly + ;; matching the first. + ;; To keep pattern is short and keep matching order, + ;; judge an important field in each pattern. + ;; Such as kernel. + (($ 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-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) (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 +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) _ ...) + (menu-entry + (label label) + (device (sexp->device device)) + (device-mount-point mount-point) + (chain-loader chain-loader))))) ;;; -- 2.37.2