From patchwork Sun Sep 4 14:04:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tiantian X-Patchwork-Id: 42204 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 1555427BBEC; Sun, 4 Sep 2022 15:12: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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, 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 E589327BBE9 for ; Sun, 4 Sep 2022 15:12:15 +0100 (BST) Received: from localhost ([::1]:37916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUqMB-0005T3-2h for patchwork@mira.cbaines.net; Sun, 04 Sep 2022 10:12:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUqLy-0005QT-Hm for guix-patches@gnu.org; Sun, 04 Sep 2022 10:12:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUqLy-00030f-9b for guix-patches@gnu.org; Sun, 04 Sep 2022 10:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUqLy-00028I-0q for guix-patches@gnu.org; Sun, 04 Sep 2022 10:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH v3 2/3] gnu: bootloader: grub: Add support for chain-loader. Resent-From: typ22@foxmail.com Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 04 Sep 2022 14:12:01 +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.16623006748133 (code B ref 57496); Sun, 04 Sep 2022 14:12:01 +0000 Received: (at 57496) by debbugs.gnu.org; 4 Sep 2022 14:11:14 +0000 Received: from localhost ([127.0.0.1]:45353 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUqLB-000277-TO for submit@debbugs.gnu.org; Sun, 04 Sep 2022 10:11:14 -0400 Received: from out162-62-57-87.mail.qq.com ([162.62.57.87]:46507) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUqL9-00026d-Fd for 57496@debbugs.gnu.org; Sun, 04 Sep 2022 10:11:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1662300662; bh=/38v54AvXd9X7OuutWCFaOGhyI/aaDiJEgK2pAlddnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v2F53S2S8EOy8ck7A2FGtQ+kVkjaS/gr78q0pDMlZgDAStExc1pNerh95Ms3u4Dqt a4PqjeLIktSbwGcLh9WdbyVdC4nWhOsWExQxJbXTpZDmrEzZtZQ9T7l8nnVEJGJnvP tmyszcWoBPHlr52JjEcqp+iNYAM1EkMN0DVKy9AY= Received: from localhost.localdomain ([240e:398:28a4:3121:5ae1:85dd:ab7b:103f]) by newxmesmtplogicsvrsza7.qq.com (NewEsmtp) with SMTP id 2AE98672; Sun, 04 Sep 2022 22:10:46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un, 4 Sep 2022 22:04:28 +0800 X-OQ-MSGID: <47c28682c4fe87a8ec53bf3c9687c1cf011d880c.1662298270.git.typ22@foxmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <849b9ddea2a18dc4b2fd05450f0c90e3e5a05421.1662298270.git.typ22@foxmail.com> References: <849b9ddea2a18dc4b2fd05450f0c90e3e5a05421.1662298270.git.typ22@foxmail.com> 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" X-getmail-retrieved-from-mailbox: Patches From: tiantian * gnu/bootloader/grub.scm (grub-configuration-file): Add support for chain-loader. --- It is no different from v2 patch. gnu/bootloader/grub.scm | 73 ++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 30 deletions(-) diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 4f18c9b518..7283257354 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -374,44 +374,57 @@ (define* (grub-configuration-file config entries (let ((label (menu-entry-label entry)) (linux (menu-entry-linux entry)) (device (menu-entry-device entry)) - (device-mount-point (menu-entry-device-mount-point entry))) - (if linux - (let ((arguments (menu-entry-linux-arguments entry)) - (linux (normalize-file linux - device-mount-point - store-directory-prefix)) - (initrd (normalize-file (menu-entry-initrd entry) - device-mount-point - store-directory-prefix))) - ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. - ;; Use the right file names for LINUX and INITRD in case - ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a - ;; separate partition. - - ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the linux and - ;; initrd paths, to allow booting from a Btrfs subvolume. - #~(format port "menuentry ~s { + (device-mount-point (menu-entry-device-mount-point entry)) + (multiboot-kernel (menu-entry-multiboot-kernel entry)) + (chain-loader (menu-entry-chain-loader entry))) + (cond + (linux + (let ((arguments (menu-entry-linux-arguments entry)) + (linux (normalize-file linux + device-mount-point + store-directory-prefix)) + (initrd (normalize-file (menu-entry-initrd entry) + device-mount-point + store-directory-prefix))) + ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. + ;; Use the right file names for LINUX and INITRD in case + ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a + ;; separate partition. + + ;; When BTRFS-SUBVOLUME-FILE-NAME is defined, prepend it the linux and + ;; initrd paths, to allow booting from a Btrfs subvolume. + #~(format port "menuentry ~s { ~a linux ~a ~a initrd ~a }~%" - #$label - #$(grub-root-search device linux) - #$linux (string-join (list #$@arguments)) - #$initrd)) - (let ((kernel (menu-entry-multiboot-kernel entry)) - (arguments (menu-entry-multiboot-arguments entry)) - (modules (menu-entry-multiboot-modules entry)) - (root-index 1)) ; XXX EFI will need root-index 2 - #~(format port " + #$label + #$(grub-root-search device linux) + #$linux (string-join (list #$@arguments)) + #$initrd))) + (multiboot-kernel + (let ((kernel (menu-entry-multiboot-kernel entry)) + (arguments (menu-entry-multiboot-arguments entry)) + (modules (menu-entry-multiboot-modules entry)) + (root-index 1)) ; XXX EFI will need root-index 2 + #~(format port " menuentry ~s { multiboot ~a root=device:hd0s~a~a~a +}~%" + #$label + #$kernel + #$root-index (string-join (list #$@arguments) " " 'prefix) + (string-join (map string-join '#$modules) + "\n module " 'prefix)))) + (chain-loader + #~(format port " +menuentry ~s { + ~a + chainloader ~a }~%" #$label - #$kernel - #$root-index (string-join (list #$@arguments) " " 'prefix) - (string-join (map string-join '#$modules) - "\n module " 'prefix)))))) + #$(grub-root-search device chain-loader) + #$chain-loader))))) (define (crypto-devices) (define (crypto-device->cryptomount dev)