From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id mNpuBTyyFGOmDQEAbAwnHQ (envelope-from ) for ; Sun, 04 Sep 2022 16:12:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id kAqJBDyyFGOpxgAAG6o9tA (envelope-from ) for ; Sun, 04 Sep 2022 16:12:12 +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 A604425B3C for ; Sun, 4 Sep 2022 16:12:11 +0200 (CEST) Received: from localhost ([::1]:37916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUqM6-0005T3-BZ for larch@yhetil.org; Sun, 04 Sep 2022 10:12:10 -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 +0800 X-QQ-mid: xmsmtpt1662300648tqh8qzgbo Message-ID: X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e87a8ec53bf3c9687c1cf011d880c.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 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=1662300731; 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=/38v54AvXd9X7OuutWCFaOGhyI/aaDiJEgK2pAlddnQ=; b=uF9tuU2XGjnYC7xJWQJn/4rHN1nmaZ9pXkI0s5CloBBTB/8tMMx9N+tzlr9j0D/ceIJO4U K2Ouc6wtSIcWzRuhfs0yA4O8vc5qOn6J0chXwujObMHiM026ZDuHNAQzmDyD8Q6om2Cozk jo8yQlw/dQdlsgfEQRY26ADyKA737AIB7F1S1EMtv9ApFvleLUWF2eFJzm1d5xDR2WYi6F Ze7GbcHdV6WCzrvBH0x2BDq6YebEnonv0I92p14eVGjOyJGPaB6HMUb+w6vdTBKxpq4A+v 5p+v1LEN3YoCZw3ZKkVKAwxNSQdoozPrGqcqzHPMoFXLh9NyqLEECgrDd/qNhQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662300731; a=rsa-sha256; cv=none; b=jF+i4Ss3t1/lcd4bwtRfN5Df1GVZ/rYw/eya5cC6TVlU80ngNTBxJIjgRucWCVwph+s61H rkh0iuKaV/S8bzptl+DS/m2tNikhTFirkejcYg1FTSt1DOKJjveuhCdi1ypPrCfGrgY+PS hQRoiWd0TwVs4M8j9bOI+z/nE71vCBXLTtXflgNFNCuGCgc0EZAtWneMTSXq11JsdjNiTt cqkadzMQoYP9IC4x+H8PVBa6WbPJY9gMEVpE7a7yQNmcR/80EA58MrNNGDnwBJARQWsbDH AJWG7XQnzPn/rBSWkZq5Ti9/z8jrTcbufN85QYHMeacVmzDIz9zuryAe3btgiQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b=v2F53S2S; 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: 6.72 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b=v2F53S2S; 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: A604425B3C X-Spam-Score: 6.72 X-Migadu-Scanner: scn1.migadu.com X-TUID: ybYBxKa+yltU 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) -- 2.37.2