guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

07/24: bootloader: Extend `<menu-entry>' for multiboot.


From: guix-commits
Subject: 07/24: bootloader: Extend `<menu-entry>' for multiboot.
Date: Sat, 6 Jun 2020 18:16:40 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit 58eb64152fbba70a72565f196716ac9226975ddd
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Tue May 26 16:54:18 2020 +0200

    bootloader: Extend `<menu-entry>' for multiboot.
    
    * gnu/bootloader.scm (<menu-entry>)[multiboot-kernel,multiboot-arguments,
    multiboot-modules]: New fields.
    [linux,initrd]: Add default value '#f'.
    (menu-entry->sexp, sexp->menu-entry): Support multiboot entry.
    * doc/guix.texi (Bootloader Configuration): Document them.
---
 doc/guix.texi      | 27 +++++++++++++++++++++++++--
 gnu/bootloader.scm | 46 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 66 insertions(+), 7 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46aceae..167a0a8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -26985,7 +26985,7 @@ The type of an entry in the bootloader menu.
 @item @code{label}
 The label to show in the menu---e.g., @code{"GNU"}.
 
-@item @code{linux}
+@item @code{linux} (default: @code{#f})
 The Linux kernel image to boot, for example:
 
 @lisp
@@ -27007,9 +27007,10 @@ field is ignored entirely.
 The list of extra Linux kernel command-line arguments---e.g.,
 @code{("console=ttyS0")}.
 
-@item @code{initrd}
+@item @code{initrd} (default: @code{#f})
 A G-Expression or string denoting the file name of the initial RAM disk
 to use (@pxref{G-Expressions}).
+
 @item @code{device} (default: @code{#f})
 The device where the kernel and initrd are to be found---i.e., for GRUB,
 @dfn{root} for this menu entry (@pxref{root,,, grub, GNU GRUB manual}).
@@ -27020,6 +27021,28 @@ the bootloader will search the device containing the 
file specified by
 the @code{linux} field (@pxref{search,,, grub, GNU GRUB manual}).  It
 must @emph{not} be an OS device name such as @file{/dev/sda1}.
 
+@item @code{multiboot-kernel} (default: @code{#f})
+The kernel to boot in Multiboot-mode (@pxref{multiboot,,, grub, GNU GRUB
+manual}).  When this field is set, a Multiboot menu-entry is generated.
+For example:
+
+@lisp
+(file-append mach "/boot/gnumach")
+@end lisp
+
+@item @code{multiboot-arguments} (default: @code{()})
+The list of extra command-line arguments for the multiboot-kernel.
+
+@item @code{multiboot-modules} (default: @code{()})
+The list of commands for loading Multiboot modules.  For example:
+
+@lisp
+(list (list (file-append hurd "/hurd/ext2fs.static") "ext2fs"
+             @dots{})
+      (list (file-append libc "/lib/ld.so.1") "exec"
+             @dots{}))
+@end lisp
+
 @end table
 @end deftp
 
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm
index 668caa7..2eebb8e 100644
--- a/gnu/bootloader.scm
+++ b/gnu/bootloader.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,6 +34,9 @@
             menu-entry-linux-arguments
             menu-entry-initrd
             menu-entry-device-mount-point
+            menu-entry-multiboot-kernel
+            menu-entry-multiboot-arguments
+            menu-entry-multiboot-modules
 
             menu-entry->sexp
             sexp->menu-entry
@@ -77,22 +81,41 @@
                    (default #f))
   (device-mount-point menu-entry-device-mount-point
                    (default #f))
-  (linux           menu-entry-linux)
+  (linux           menu-entry-linux
+                   (default #f))
   (linux-arguments menu-entry-linux-arguments
                    (default '()))          ; list of string-valued gexps
-  (initrd          menu-entry-initrd))     ; file name of the initrd as a gexp
+  (initrd          menu-entry-initrd       ; file name of the initrd as a gexp
+                   (default #f))
+  (multiboot-kernel menu-entry-multiboot-kernel
+                    (default #f))
+  (multiboot-arguments menu-entry-multiboot-arguments
+                       (default '()))      ; list of string-valued gexps
+  (multiboot-modules menu-entry-multiboot-modules
+                     (default '())))       ; list of multiboot commands, where
+                                           ; a command is a list of <string>
 
 (define (menu-entry->sexp entry)
   "Return ENTRY serialized as an sexp."
   (match entry
-    (($ <menu-entry> label device mount-point linux linux-arguments initrd)
+    (($ <menu-entry> label device mount-point linux linux-arguments initrd #f
+                     ())
      `(menu-entry (version 0)
                   (label ,label)
                   (device ,device)
                   (device-mount-point ,mount-point)
                   (linux ,linux)
                   (linux-arguments ,linux-arguments)
-                  (initrd ,initrd)))))
+                  (initrd ,initrd)))
+    (($ <menu-entry> label device mount-point #f () #f
+                     multiboot-kernel multiboot-arguments multiboot-modules)
+     `(menu-entry (version 0)
+                  (label ,label)
+                  (device ,device)
+                  (device-mount-point ,mount-point)
+                  (multiboot-kernel ,multiboot-kernel)
+                  (multiboot-arguments ,multiboot-arguments)
+                  (multiboot-modules ,multiboot-modules)))))
 
 (define (sexp->menu-entry sexp)
   "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry>
@@ -109,7 +132,20 @@ record."
       (device-mount-point mount-point)
       (linux linux)
       (linux-arguments linux-arguments)
-      (initrd initrd)))))
+      (initrd initrd)))
+    (('menu-entry ('version 0)
+                  ('label label) ('device device)
+                  ('device-mount-point mount-point)
+                  ('multiboot-kernel multiboot-kernel)
+                  ('multiboot-arguments multiboot-arguments)
+                  ('multiboot-modules multiboot-modules) _ ...)
+     (menu-entry
+      (label label)
+      (device device)
+      (device-mount-point mount-point)
+      (multiboot-kernel multiboot-kernel)
+      (multiboot-arguments multiboot-arguments)
+      (multiboot-modules multiboot-modules)))))
 
 
 ;;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]