diff options
| author | Jan (janneke) Nieuwenhuizen <janneke@gnu.org> | 2020-05-26 16:54:18 +0200 |
|---|---|---|
| committer | Jan Nieuwenhuizen <janneke@gnu.org> | 2020-06-08 13:51:18 +0200 |
| commit | 21acd8d6c11b85d06c82b168807b35cb7d2d0adf (patch) | |
| tree | 8819395e3d31a944d5c2763bfa3fad287def5a43 | |
| parent | 2018fb2afe20988193a50fe30159725f51db0a4b (diff) | |
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.
| -rw-r--r-- | doc/guix.texi | 27 | ||||
| -rw-r--r-- | gnu/bootloader.scm | 46 |
2 files changed, 66 insertions, 7 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 46aceae0682..167a0a84d6d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -26985,7 +26985,7 @@ The type of an entry in the bootloader menu. | |||
| 26985 | @item @code{label} | 26985 | @item @code{label} |
| 26986 | The label to show in the menu---e.g., @code{"GNU"}. | 26986 | The label to show in the menu---e.g., @code{"GNU"}. |
| 26987 | 26987 | ||
| 26988 | @item @code{linux} | 26988 | @item @code{linux} (default: @code{#f}) |
| 26989 | The Linux kernel image to boot, for example: | 26989 | The Linux kernel image to boot, for example: |
| 26990 | 26990 | ||
| 26991 | @lisp | 26991 | @lisp |
| @@ -27007,9 +27007,10 @@ field is ignored entirely. | |||
| 27007 | The list of extra Linux kernel command-line arguments---e.g., | 27007 | The list of extra Linux kernel command-line arguments---e.g., |
| 27008 | @code{("console=ttyS0")}. | 27008 | @code{("console=ttyS0")}. |
| 27009 | 27009 | ||
| 27010 | @item @code{initrd} | 27010 | @item @code{initrd} (default: @code{#f}) |
| 27011 | A G-Expression or string denoting the file name of the initial RAM disk | 27011 | A G-Expression or string denoting the file name of the initial RAM disk |
| 27012 | to use (@pxref{G-Expressions}). | 27012 | to use (@pxref{G-Expressions}). |
| 27013 | |||
| 27013 | @item @code{device} (default: @code{#f}) | 27014 | @item @code{device} (default: @code{#f}) |
| 27014 | The device where the kernel and initrd are to be found---i.e., for GRUB, | 27015 | The device where the kernel and initrd are to be found---i.e., for GRUB, |
| 27015 | @dfn{root} for this menu entry (@pxref{root,,, grub, GNU GRUB manual}). | 27016 | @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 | |||
| 27020 | the @code{linux} field (@pxref{search,,, grub, GNU GRUB manual}). It | 27021 | the @code{linux} field (@pxref{search,,, grub, GNU GRUB manual}). It |
| 27021 | must @emph{not} be an OS device name such as @file{/dev/sda1}. | 27022 | must @emph{not} be an OS device name such as @file{/dev/sda1}. |
| 27022 | 27023 | ||
| 27024 | @item @code{multiboot-kernel} (default: @code{#f}) | ||
| 27025 | The kernel to boot in Multiboot-mode (@pxref{multiboot,,, grub, GNU GRUB | ||
| 27026 | manual}). When this field is set, a Multiboot menu-entry is generated. | ||
| 27027 | For example: | ||
| 27028 | |||
| 27029 | @lisp | ||
| 27030 | (file-append mach "/boot/gnumach") | ||
| 27031 | @end lisp | ||
| 27032 | |||
| 27033 | @item @code{multiboot-arguments} (default: @code{()}) | ||
| 27034 | The list of extra command-line arguments for the multiboot-kernel. | ||
| 27035 | |||
| 27036 | @item @code{multiboot-modules} (default: @code{()}) | ||
| 27037 | The list of commands for loading Multiboot modules. For example: | ||
| 27038 | |||
| 27039 | @lisp | ||
| 27040 | (list (list (file-append hurd "/hurd/ext2fs.static") "ext2fs" | ||
| 27041 | @dots{}) | ||
| 27042 | (list (file-append libc "/lib/ld.so.1") "exec" | ||
| 27043 | @dots{})) | ||
| 27044 | @end lisp | ||
| 27045 | |||
| 27023 | @end table | 27046 | @end table |
| 27024 | @end deftp | 27047 | @end deftp |
| 27025 | 27048 | ||
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 668caa7fc3f..2eebb8e9d9c 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> | 3 | ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com> |
| 4 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> | 4 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> |
| 5 | ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> | 5 | ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> |
| 6 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> | ||
| 6 | ;;; | 7 | ;;; |
| 7 | ;;; This file is part of GNU Guix. | 8 | ;;; This file is part of GNU Guix. |
| 8 | ;;; | 9 | ;;; |
| @@ -33,6 +34,9 @@ | |||
| 33 | menu-entry-linux-arguments | 34 | menu-entry-linux-arguments |
| 34 | menu-entry-initrd | 35 | menu-entry-initrd |
| 35 | menu-entry-device-mount-point | 36 | menu-entry-device-mount-point |
| 37 | menu-entry-multiboot-kernel | ||
| 38 | menu-entry-multiboot-arguments | ||
| 39 | menu-entry-multiboot-modules | ||
| 36 | 40 | ||
| 37 | menu-entry->sexp | 41 | menu-entry->sexp |
| 38 | sexp->menu-entry | 42 | sexp->menu-entry |
| @@ -77,22 +81,41 @@ | |||
| 77 | (default #f)) | 81 | (default #f)) |
| 78 | (device-mount-point menu-entry-device-mount-point | 82 | (device-mount-point menu-entry-device-mount-point |
| 79 | (default #f)) | 83 | (default #f)) |
| 80 | (linux menu-entry-linux) | 84 | (linux menu-entry-linux |
| 85 | (default #f)) | ||
| 81 | (linux-arguments menu-entry-linux-arguments | 86 | (linux-arguments menu-entry-linux-arguments |
| 82 | (default '())) ; list of string-valued gexps | 87 | (default '())) ; list of string-valued gexps |
| 83 | (initrd menu-entry-initrd)) ; file name of the initrd as a gexp | 88 | (initrd menu-entry-initrd ; file name of the initrd as a gexp |
| 89 | (default #f)) | ||
| 90 | (multiboot-kernel menu-entry-multiboot-kernel | ||
| 91 | (default #f)) | ||
| 92 | (multiboot-arguments menu-entry-multiboot-arguments | ||
| 93 | (default '())) ; list of string-valued gexps | ||
| 94 | (multiboot-modules menu-entry-multiboot-modules | ||
| 95 | (default '()))) ; list of multiboot commands, where | ||
| 96 | ; a command is a list of <string> | ||
| 84 | 97 | ||
| 85 | (define (menu-entry->sexp entry) | 98 | (define (menu-entry->sexp entry) |
| 86 | "Return ENTRY serialized as an sexp." | 99 | "Return ENTRY serialized as an sexp." |
| 87 | (match entry | 100 | (match entry |
| 88 | (($ <menu-entry> label device mount-point linux linux-arguments initrd) | 101 | (($ <menu-entry> label device mount-point linux linux-arguments initrd #f |
| 102 | ()) | ||
| 89 | `(menu-entry (version 0) | 103 | `(menu-entry (version 0) |
| 90 | (label ,label) | 104 | (label ,label) |
| 91 | (device ,device) | 105 | (device ,device) |
| 92 | (device-mount-point ,mount-point) | 106 | (device-mount-point ,mount-point) |
| 93 | (linux ,linux) | 107 | (linux ,linux) |
| 94 | (linux-arguments ,linux-arguments) | 108 | (linux-arguments ,linux-arguments) |
| 95 | (initrd ,initrd))))) | 109 | (initrd ,initrd))) |
| 110 | (($ <menu-entry> label device mount-point #f () #f | ||
| 111 | multiboot-kernel multiboot-arguments multiboot-modules) | ||
| 112 | `(menu-entry (version 0) | ||
| 113 | (label ,label) | ||
| 114 | (device ,device) | ||
| 115 | (device-mount-point ,mount-point) | ||
| 116 | (multiboot-kernel ,multiboot-kernel) | ||
| 117 | (multiboot-arguments ,multiboot-arguments) | ||
| 118 | (multiboot-modules ,multiboot-modules))))) | ||
| 96 | 119 | ||
| 97 | (define (sexp->menu-entry sexp) | 120 | (define (sexp->menu-entry sexp) |
| 98 | "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> | 121 | "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> |
| @@ -109,7 +132,20 @@ record." | |||
| 109 | (device-mount-point mount-point) | 132 | (device-mount-point mount-point) |
| 110 | (linux linux) | 133 | (linux linux) |
| 111 | (linux-arguments linux-arguments) | 134 | (linux-arguments linux-arguments) |
| 112 | (initrd initrd))))) | 135 | (initrd initrd))) |
| 136 | (('menu-entry ('version 0) | ||
| 137 | ('label label) ('device device) | ||
| 138 | ('device-mount-point mount-point) | ||
| 139 | ('multiboot-kernel multiboot-kernel) | ||
| 140 | ('multiboot-arguments multiboot-arguments) | ||
| 141 | ('multiboot-modules multiboot-modules) _ ...) | ||
| 142 | (menu-entry | ||
| 143 | (label label) | ||
| 144 | (device device) | ||
| 145 | (device-mount-point mount-point) | ||
| 146 | (multiboot-kernel multiboot-kernel) | ||
| 147 | (multiboot-arguments multiboot-arguments) | ||
| 148 | (multiboot-modules multiboot-modules))))) | ||
| 113 | 149 | ||
| 114 | 150 | ||
| 115 | ;;; | 151 | ;;; |
