From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oNErK4b+2F6oTwAA0tVLHw (envelope-from ) for ; Thu, 04 Jun 2020 14:00:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id OM0PJ4b+2F7GWAAA1q6Kng (envelope-from ) for ; Thu, 04 Jun 2020 14:00:38 +0000 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 18B7C940EF0 for ; Thu, 4 Jun 2020 14:00:18 +0000 (UTC) Received: from localhost ([::1]:41680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgqPo-0001VJ-RT for larch@yhetil.org; Thu, 04 Jun 2020 10:00:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgqPc-0001OH-Ap for bug-guix@gnu.org; Thu, 04 Jun 2020 10:00:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgqPb-00026H-WD for bug-guix@gnu.org; Thu, 04 Jun 2020 10:00:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgqPb-0004Yl-VR for bug-guix@gnu.org; Thu, 04 Jun 2020 10:00:03 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#41541: [PATCH 4/8] bootloader: grub: Add support for multiboot. Resent-From: "Jan (janneke) Nieuwenhuizen" Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Thu, 04 Jun 2020 14:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41541 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 41541@debbugs.gnu.org Received: via spool by 41541-submit@debbugs.gnu.org id=B41541.159127917417388 (code B ref 41541); Thu, 04 Jun 2020 14:00:03 +0000 Received: (at 41541) by debbugs.gnu.org; 4 Jun 2020 13:59:34 +0000 Received: from localhost ([127.0.0.1]:47136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgqP7-0004WI-Gw for submit@debbugs.gnu.org; Thu, 04 Jun 2020 09:59:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgqP3-0004V7-LD for 41541@debbugs.gnu.org; Thu, 04 Jun 2020 09:59:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33095) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgqOy-0001vH-B7; Thu, 04 Jun 2020 09:59:24 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=43728 helo=dundal.fritz.box) by fencepost.gnu.org with esmtpa (Exim 4.82) (envelope-from ) id 1jgqOx-0000GG-L9; Thu, 04 Jun 2020 09:59:24 -0400 From: "Jan (janneke) Nieuwenhuizen" Date: Thu, 4 Jun 2020 15:59:10 +0200 Message-Id: <20200604135914.4499-5-janneke@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200604135914.4499-1-janneke@gnu.org> References: <20200604135914.4499-1-janneke@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 3.99 X-TUID: esBpVQcxU4Aq * gnu/bootloader/grub.scm (grub-configuration-file): Add support for multiboot. --- gnu/bootloader.scm | 3 +- gnu/bootloader/grub.scm | 71 +++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 2eebb8e9d9..d0bcab1a06 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -26,7 +26,8 @@ #:use-module (guix ui) #:use-module (srfi srfi-1) #:use-module (ice-9 match) - #:export (menu-entry + #:export ( + menu-entry menu-entry? menu-entry-label menu-entry-device diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 2d9a39afc3..3e95fece1c 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -25,12 +25,16 @@ #:use-module (guix records) #:use-module ((guix utils) #:select (%current-system)) #:use-module (guix gexp) + #:use-module (guix utils) #:use-module (gnu artwork) #:use-module (gnu bootloader) #:use-module (gnu system uuid) #:use-module (gnu system file-systems) #:use-module (gnu system keyboard) + #:use-module (gnu packages base) #:use-module (gnu packages bootloaders) + #:use-module (gnu packages cross-base) + #:use-module (gnu packages hurd) #:autoload (gnu packages gtk) (guile-cairo guile-rsvg) #:autoload (gnu packages xorg) (xkeyboard-config) #:use-module (ice-9 match) @@ -330,36 +334,49 @@ when booting a root file system on a Btrfs subvolume." (define all-entries (append entries (bootloader-configuration-menu-entries config))) (define (menu-entry->gexp entry) - (let* ((device (menu-entry-device entry)) - (device-mount-point (menu-entry-device-mount-point entry)) - (label (menu-entry-label entry)) - (arguments (menu-entry-linux-arguments entry)) - (kernel (normalize-file (menu-entry-linux entry) - 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 KERNEL and INITRD in case - ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a - ;; separate partition. - #~(format port "menuentry ~s { + (match entry + (($ label device mount-point linux arguments initrd #f ()) + (let ((linux (normalize-file linux mount-point + store-directory-prefix)) + (initrd (normalize-file initrd 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 kernel) - #$kernel (string-join (list #$@arguments)) - #$initrd))) - (define sugar - (eye-candy config - (menu-entry-device (first all-entries)) - (menu-entry-device-mount-point (first all-entries)) - #:store-directory-prefix store-directory-prefix - #:system system - #:port #~port)) + #$label + #$(grub-root-search device linux) + #$linux (string-join (list #$@arguments)) + #$initrd))) + (($ label device mount-point #f () #f kernel arguments modules) + (let* ((target (%current-target-system))) + #~(format port " +menuentry ~s { + multiboot ~a root=device:hd0s1~a~a +}~%" + #$label + #$kernel (string-join (list #$@arguments) " " 'prefix) + (string-join (map string-join '#$modules) + "\n module " 'prefix)))))) + + (define (sugar) + (let* ((entry (first all-entries)) + (device (menu-entry-device entry)) + (mount-point (menu-entry-device-mount-point entry))) + (eye-candy config + device + mount-point + #:store-directory-prefix store-directory-prefix + #:system system + #:port #~port))) (define keyboard-layout-config (let* ((layout (bootloader-configuration-keyboard-layout config)) @@ -384,7 +401,7 @@ keymap ~a~%" #$keymap)))) "# This file was generated from your Guix configuration. Any changes # will be lost upon reconfiguration. ") - #$sugar + #$(sugar) #$keyboard-layout-config (format port " set default=~a -- 2.26.2