From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 WHb/DsBMEGO/QAEAbAwnHQ (envelope-from ) for ; Thu, 01 Sep 2022 08:10:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MNSrDsBMEGPdXgAAauVa8A (envelope-from ) for ; Thu, 01 Sep 2022 08:10:08 +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 E80381E59E for ; Thu, 1 Sep 2022 08:10:07 +0200 (CEST) Received: from localhost ([::1]:59042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTdOw-0002Ci-Ow for larch@yhetil.org; Thu, 01 Sep 2022 02:10:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTdNu-000293-RI for guix-patches@gnu.org; Thu, 01 Sep 2022 02:09:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oTdNu-0005Qf-Ie for guix-patches@gnu.org; Thu, 01 Sep 2022 02:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oTdNu-0003m2-E3 for guix-patches@gnu.org; Thu, 01 Sep 2022 02:09:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH v2 2/2] 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: Thu, 01 Sep 2022 06:09: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 , tiantian Received: via spool by 57496-submit@debbugs.gnu.org id=B57496.166201249514409 (code B ref 57496); Thu, 01 Sep 2022 06:09:02 +0000 Received: (at 57496) by debbugs.gnu.org; 1 Sep 2022 06:08:15 +0000 Received: from localhost ([127.0.0.1]:40934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTdN8-0003kK-Tm for submit@debbugs.gnu.org; Thu, 01 Sep 2022 02:08:15 -0400 Received: from out162-62-57-49.mail.qq.com ([162.62.57.49]:49329) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oTdN5-0003k1-8Q for 57496@debbugs.gnu.org; Thu, 01 Sep 2022 02:08:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1662012483; bh=mqgUZOfI1m3e4AZZBbv7sM++22VKoKxajGTlnm9JE5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VrZn4ttGfXaKg28fMM/P5f1//1+uEE5tJSpDF5tGWg4fqfAouetymgjbDhi+TQbB3 9ikFLkgfLGDkL23r0LwbJgAzqu5y6QNCjDDb3/H0MWYk2vr6On9vywlIcU3kKQtar3 qqhotFxg8NOCsAg3cWiBmmJJetKS8d6VPdDAZYbc= Received: from localhost.localdomain ([240e:398:28aa:8901:2e5d:53be:47ef:3da]) by newxmesmtplogicsvrsza8.qq.com (NewEsmtp) with SMTP id 1D3814E2; Thu, 01 Sep 2022 14:07:19 +0800 X-QQ-mid: xmsmtpt1662012440tnn6l8rr7 Message-ID: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g= From: typ22@foxmail.com Date: Thu, 1 Sep 2022 14:03:16 +0800 X-OQ-MSGID: <91016c9aa9267b0b19fdb30f203cc78db9c4162e.1662010955.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=1662012608; 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=mqgUZOfI1m3e4AZZBbv7sM++22VKoKxajGTlnm9JE5g=; b=DEbpxs9yh+hzSYEOxYNQX8pOKIF94l3VI/RWAfEaVaNibGekBGcXTD5XdvFwZIitKHT7ls biTPrITTr9pZHZUGfIjJO7QPLifttrklQt/yHeh1d3ogS07w6a5YsdNjATEjcM3MjK9A06 d2KfV9BvU0x0z68d9DOlpDFfuRHjq7Hbc2lAID0lqqeEnGI92qpGtzJYnrbWq1+D4B++kZ slmZA35vZDp8TwfE48tF2gSdL/EgJPBvVuiuQ50USscsrk+JM2OUJ8hCmwc87VwNK5HqGS HjEU1T4t5hzJAMTgH6CDFNMIUW3QGMbLvObgWaIz6OsKdb22XDj5Wt2piVWgWg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662012608; a=rsa-sha256; cv=none; b=mjdTJOu9YA59Mwq1V5LnuGVWdhisCmmCvsJEqJSpl14FaeJE1bJpp6iANLL1oFg4M53B11 ua6mVFj+iaJRvHArNhSD76Dl2Do3fMe94l5Si2yl5J2m7fCY5/4SVVNwcC2nsj5ppT7rYa riKWRaKvugegQRd7ediHH/d42WsUKiYx7GppYXx5dybs1zgqeAy3cuTZSbRNSFM+O9UqeT wdY6Yk1oB86UWoBZmgDMZIPUW7n3Cp88CcyktGP/ywNitqfW7FWlcUccvBcUbxqxKoixyC JmKXx/CcLP5lJ1kuQ6MMj/ui88Vw7A1xVsnCkV30rws12WeHuoVnI7juhXZ2Rg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b=VrZn4ttG; 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.22 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b=VrZn4ttG; 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: E80381E59E X-Spam-Score: 8.22 X-Migadu-Spam: Yes X-Migadu-Scanner: scn1.migadu.com X-TUID: wMVnD9t+2RNg From: tiantian * gnu/bootloader/grub.scm (grub-configuration-file): Add support for chain-loader. --- It is no different from v1 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