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 oMGHKizgFGPGFAEAbAwnHQ (envelope-from ) for ; Sun, 04 Sep 2022 19:28:12 +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 mt+2KSzgFGOu6gAAG6o9tA (envelope-from ) for ; Sun, 04 Sep 2022 19:28: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 621A91365 for ; Sun, 4 Sep 2022 19:28:12 +0200 (CEST) Received: from localhost ([::1]:46234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oUtPn-0000Wu-F6 for larch@yhetil.org; Sun, 04 Sep 2022 13:28:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oUtPe-0000Ve-Jl for guix-patches@gnu.org; Sun, 04 Sep 2022 13:28:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56911) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oUtPe-0004Lg-BQ for guix-patches@gnu.org; Sun, 04 Sep 2022 13:28:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oUtPe-0007Bj-5B for guix-patches@gnu.org; Sun, 04 Sep 2022 13:28:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57496] [PATCH v4 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 17:28: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.eu, tiantian Received: via spool by 57496-submit@debbugs.gnu.org id=B57496.166231246727591 (code B ref 57496); Sun, 04 Sep 2022 17:28:02 +0000 Received: (at 57496) by debbugs.gnu.org; 4 Sep 2022 17:27:47 +0000 Received: from localhost ([127.0.0.1]:45606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUtPP-0007Ax-6X for submit@debbugs.gnu.org; Sun, 04 Sep 2022 13:27:47 -0400 Received: from out162-62-57-64.mail.qq.com ([162.62.57.64]:39021) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oUtPN-0007Ag-25 for 57496@debbugs.gnu.org; Sun, 04 Sep 2022 13:27:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1662312455; bh=K2KEaGF1Z/wq2RfdW16B7Tvop2xEYaIG+A5AOK+vmwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ef2LnPLnywuTMa07Uj87e3TSSER96E3oSjoTGtrBH4M7wmviim9+eiQyfBGTp5H9a rvS0kZ8946ryexqRE/sntQtLxPfboRLeg6igyxLy1cDYv6Y7KnCPpJ4oHyAHgn39Ib 4qxQARHsJmb1IJ//+GGu3dIL+PyzRxA6g7gFr8zg= Received: from localhost.localdomain ([240e:398:28a4:3121:5ae1:85dd:ab7b:103f]) by newxmesmtplogicsvrsza31.qq.com (NewEsmtp) with SMTP id 6A38201E; Mon, 05 Sep 2022 01:26:35 +0800 X-QQ-mid: xmsmtpt1662312397tnp5mmfky Message-ID: X-QQ-XMAILINFO: OXimaFo5SPf+NIPIPZcNdpymtPUPrBm8pz/q01R7jkuqWj0QG9TOM3Ro6R4boY NyAGSt3HJmTb41lkbFMzn8oyu0lr2FKDbQU3lzFD14tiRi2DBYgIxRPkmH0yhdHAE/bOrWQ6arX9 WmVlnC7Bgly6Qs+GmzXxD9d19PuurwSfKtSu/2Fhx+ogecrRdMb0Z8Ca4iitghcy/1Xbdncq5dGY b2EEkpxhabDYCdo4G/pA6hiREjnSH+a03WtQp9jzBhSzL+TtZTethHNX2DExs91/5H13tNSwh1bQ 7PmN1d86CoKMK+LExIDfWhYH7XnXq9ppI8DCdZXXBXneLmLNSdadfFp+K/SKPkd7YevkdfODFv24 kDCOML1gPTqCvRcdio7v4xwRdufujvzukESRdYeZ4/gcxfZDbh9NFMMa10OkfDTBCial+WTpf24B jg4+llRRvS/VbC8Vfjo5lCNFoH3ceXZX73lzhwmOSywsUtdgluu3lcrCMWKW7fezE74lOF4nLyU4 Ful3KRo9e+N1qUrV4xyHLiqPcVmTNy279gcj6i5i2M1j0YWS49EYqSDZYZwzJcD7fHiV+V+xIZKv pGcYerxsc0ThimttrYwd2wKLSMnYhmEx+cXkh9E7/u+uB8aknWsvD/A8Sxk33q51adkKHy7vKxKE Qj222vVvcE9g60QzpmDhgqisB9jeoyMjt+WUf2kt+HWt/nlbIUAdDR4NK6s/+Far8A+SM/hldO/k tdDQguqAN7+b8t6JylwzfY1a5kpxvcmDOt8XrtHjTKxV6Tu0dWthS7RQyBwh8AS3N5SxhtIwR+V9 n75u1xhpkTDT0mswTSLXu6gWKjnfNIYtCLG3pT3a7DID6cKLoqv8nk79mNal8derNb1B0MUhIbPd khorm5Jp7qibr6ji7xII1agQBg1QVPmLKJHgcWrC13fuWkqWk+jKFyEE0XbE/1yWz3aICVroaDY4 GobcxDHzXhV24rFzTVQd9rmuyydDIzdGJPmkt4IwoBe1y0lvuzqQ== From: typ22@foxmail.com Date: Mon, 5 Sep 2022 01:25:40 +0800 X-OQ-MSGID: X-Mailer: git-send-email 2.37.2 In-Reply-To: <09eabac17314272dcb5a8d2dbbbcfb55a05ecea2.1662308919.git.typ22@foxmail.com> References: <09eabac17314272dcb5a8d2dbbbcfb55a05ecea2.1662308919.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=1662312492; 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=K2KEaGF1Z/wq2RfdW16B7Tvop2xEYaIG+A5AOK+vmwg=; b=T24ST6vgLWPx9qsXxIR5IbFEajmcv5L9VMIyXooDpc9547CS+wVicgxDJsTa/9dTGXubg0 M22U6tucbWbJiOOdz6LYhWwxN1RYYRo/doMlj68mQPzlqNKhcpjXkwaNOb71YHSN+Eaj4G rxhJurNKvuNUKHHsqAcFpoiZ1Hsj/nw8OjOo66JCUgb/ffozdEElbIA8WgmwhGcZN8RTdX 31SqhNr/2Oal1pIAbq859DtmqgwjUHkywFtWc+ckNZUyFibvRebYYSEe6TOGtixFzerBow t8mswDbruyc8LDncRTmfWvWMuqwa3q0hUDeMxbVsQrw5uYx6IUfBnF7qNAAZSA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662312492; a=rsa-sha256; cv=none; b=nJwVvCmdkdxjQ+dWvsnbGM+4qul7Lf3ItD3CL3loOW8E/8VDvnWkFRTUBTTxfPKbs3vs+Y ZeRDiOTC28DZ6iHYSNiPIWaxTOajfE6DfT09pHOXEIrge/GQggbFm0cX8oZ2e5RjahjiTY sKpponV0MZEsud5EDYxJdEIPtwt02aS43JRE1d9yoRzQnLkqVYPhKplMWOeiTncJPMnUzP /OQOeBYK0cJ+TcU+t2E6d+ZasR12lUW+2VXRdYD3ZmwsS+Qlc06eWBcYPAhGudp/hW9aTV VUqhtzBAM58g9ZlRcXNyZkb6sHrLc3bvVG0ev04/gji6ugbjfkMeHfNPATmNRQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=foxmail.com header.s=s201512 header.b=Ef2LnPLn; 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=Ef2LnPLn; 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: 621A91365 X-Spam-Score: 6.72 X-Migadu-Scanner: scn1.migadu.com X-TUID: HLrmzil49tKZ From: tiantian * gnu/bootloader/grub.scm (grub-configuration-file): Add support for chain-loader. --- It is no different from v3 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