[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/24: bootloader: grub: Add support for multiboot.
From: |
guix-commits |
Subject: |
09/24: bootloader: grub: Add support for multiboot. |
Date: |
Mon, 8 Jun 2020 08:37:27 -0400 (EDT) |
janneke pushed a commit to branch wip-hurd-vm
in repository guix.
commit 1244491a0d5334e1589159a2ff67bbc967b9648b
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Tue May 26 18:09:01 2020 +0200
bootloader: grub: Add support for multiboot.
* gnu/bootloader/grub.scm (grub-configuration-file): Add support for
multiboot.
---
gnu/bootloader/grub.scm | 76 +++++++++++++++++++++++++++++++------------------
1 file changed, 49 insertions(+), 27 deletions(-)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 2d9a39a..d4dbb57 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -330,36 +330,58 @@ 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 {
+ (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 {
~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))
+ (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))))))
+
+ (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 +406,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
- branch wip-hurd-vm created (now 09ed8bf), guix-commits, 2020/06/08
- 02/24: syscalls: set-thread-name, thread-name: Stub for the Hurd., guix-commits, 2020/06/08
- 01/24: gnu: hurd: Update to upstream Hurd-reserved xattr index., guix-commits, 2020/06/08
- 03/24: linux-boot: Update 'make-hurd-device-nodes'., guix-commits, 2020/06/08
- 04/24: image: Add Hurd support., guix-commits, 2020/06/08
- 09/24: bootloader: grub: Add support for multiboot.,
guix-commits <=
- 14/24: services: hurd: Populate system profile., guix-commits, 2020/06/08
- 10/24: system: Use 'hurd' package in label., guix-commits, 2020/06/08
- 11/24: system: examples: Add bare-hurd.tmpl., guix-commits, 2020/06/08
- 12/24: system: Support activation service for the Hurd., guix-commits, 2020/06/08
- 05/24: system: hurd: Add hurd-default-essential-services., guix-commits, 2020/06/08
- 06/24: system: Add 'hurd' field to <operating-system>., guix-commits, 2020/06/08
- 07/24: bootloader: Extend `<menu-entry>' for multiboot., guix-commits, 2020/06/08
- 16/24: services: Add `hurd-console-service-type'., guix-commits, 2020/06/08
- 17/24: services: Add `hurd-getty-service-type'., guix-commits, 2020/06/08
- 24/24: hurd-boot: Use 'setxattr' instead of invoking settrans., guix-commits, 2020/06/08