diff options
| author | tiantian <typ22@foxmail.com> | 2022-09-05 01:25:38 +0800 |
|---|---|---|
| committer | Julien Lepiller <julien@lepiller.eu> | 2022-09-08 22:29:57 +0200 |
| commit | 52d780ea2b0714d035a84e350b516ca2e2c19af1 (patch) | |
| tree | 079439d6fc244433b4fd9a5bf9a9fd4fdb01f54d | |
| parent | e8bded2de72c17317d7799b699a724086f92ed7b (diff) | |
gnu: bootloader: Extend `<menu-entry>' for chain-loader.
* gnu/bootloader.scm (<menu-entry>)[chain-loader]: New field.
(menu-entry->sexp, sexp->menu-entry): Support chain-loader.
* doc/guix.texi (Bootloader Configuration): Document it.
Co-Authored-By: Julien Lepiller <julien@lepiller.eu>
Signed-off-by: Julien Lepiller <julien@lepiller.eu>
| -rw-r--r-- | doc/guix.texi | 18 | ||||
| -rw-r--r-- | gnu/bootloader.scm | 33 |
2 files changed, 45 insertions, 6 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index db72e75a69b..c21235f28d0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -37553,6 +37553,24 @@ The list of commands for loading Multiboot modules. For example: | |||
| 37553 | @dots{})) | 37553 | @dots{})) |
| 37554 | @end lisp | 37554 | @end lisp |
| 37555 | 37555 | ||
| 37556 | @item @code{chain-loader} (default: @code{#f}) | ||
| 37557 | A string that can be accepted by @code{grub}'s @code{chainloader} | ||
| 37558 | directive. This has no effect if either @code{linux} or | ||
| 37559 | @code{multiboot-kernel} fields are specified. The following is an | ||
| 37560 | example of chainloading a different GNU/Linux system. | ||
| 37561 | |||
| 37562 | @lisp | ||
| 37563 | (bootloader | ||
| 37564 | (bootloader-configuration | ||
| 37565 | ;; @dots{} | ||
| 37566 | (menu-entries | ||
| 37567 | (list | ||
| 37568 | (menu-entry | ||
| 37569 | (label "GNU/Linux") | ||
| 37570 | (device (uuid "1C31-A17C" 'fat)) | ||
| 37571 | (chain-loader "/EFI/GNULinux/grubx64.efi")))))) | ||
| 37572 | @end lisp | ||
| 37573 | |||
| 37556 | @end table | 37574 | @end table |
| 37557 | @end deftp | 37575 | @end deftp |
| 37558 | 37576 | ||
diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 77c05e89464..9fe6b65212e 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | menu-entry-multiboot-kernel | 46 | menu-entry-multiboot-kernel |
| 47 | menu-entry-multiboot-arguments | 47 | menu-entry-multiboot-arguments |
| 48 | menu-entry-multiboot-modules | 48 | menu-entry-multiboot-modules |
| 49 | menu-entry-chain-loader | ||
| 49 | 50 | ||
| 50 | menu-entry->sexp | 51 | menu-entry->sexp |
| 51 | sexp->menu-entry | 52 | sexp->menu-entry |
| @@ -104,8 +105,10 @@ | |||
| 104 | (multiboot-arguments menu-entry-multiboot-arguments | 105 | (multiboot-arguments menu-entry-multiboot-arguments |
| 105 | (default '())) ; list of string-valued gexps | 106 | (default '())) ; list of string-valued gexps |
| 106 | (multiboot-modules menu-entry-multiboot-modules | 107 | (multiboot-modules menu-entry-multiboot-modules |
| 107 | (default '()))) ; list of multiboot commands, where | 108 | (default '())) ; list of multiboot commands, where |
| 108 | ; a command is a list of <string> | 109 | ; a command is a list of <string> |
| 110 | (chain-loader menu-entry-chain-loader | ||
| 111 | (default #f))) ; string, path of efi file | ||
| 109 | 112 | ||
| 110 | (define (menu-entry->sexp entry) | 113 | (define (menu-entry->sexp entry) |
| 111 | "Return ENTRY serialized as an sexp." | 114 | "Return ENTRY serialized as an sexp." |
| @@ -117,8 +120,9 @@ | |||
| 117 | `(label ,(file-system-label->string label))) | 120 | `(label ,(file-system-label->string label))) |
| 118 | (_ device))) | 121 | (_ device))) |
| 119 | (match entry | 122 | (match entry |
| 120 | (($ <menu-entry> label device mount-point linux linux-arguments initrd #f | 123 | (($ <menu-entry> label device mount-point |
| 121 | ()) | 124 | (? identity linux) linux-arguments (? identity initrd) |
| 125 | #f () () #f) | ||
| 122 | `(menu-entry (version 0) | 126 | `(menu-entry (version 0) |
| 123 | (label ,label) | 127 | (label ,label) |
| 124 | (device ,(device->sexp device)) | 128 | (device ,(device->sexp device)) |
| @@ -127,14 +131,22 @@ | |||
| 127 | (linux-arguments ,linux-arguments) | 131 | (linux-arguments ,linux-arguments) |
| 128 | (initrd ,initrd))) | 132 | (initrd ,initrd))) |
| 129 | (($ <menu-entry> label device mount-point #f () #f | 133 | (($ <menu-entry> label device mount-point #f () #f |
| 130 | multiboot-kernel multiboot-arguments multiboot-modules) | 134 | (? identity multiboot-kernel) multiboot-arguments |
| 135 | multiboot-modules #f) | ||
| 131 | `(menu-entry (version 0) | 136 | `(menu-entry (version 0) |
| 132 | (label ,label) | 137 | (label ,label) |
| 133 | (device ,(device->sexp device)) | 138 | (device ,(device->sexp device)) |
| 134 | (device-mount-point ,mount-point) | 139 | (device-mount-point ,mount-point) |
| 135 | (multiboot-kernel ,multiboot-kernel) | 140 | (multiboot-kernel ,multiboot-kernel) |
| 136 | (multiboot-arguments ,multiboot-arguments) | 141 | (multiboot-arguments ,multiboot-arguments) |
| 137 | (multiboot-modules ,multiboot-modules))))) | 142 | (multiboot-modules ,multiboot-modules))) |
| 143 | (($ <menu-entry> label device mount-point #f () #f #f () () | ||
| 144 | (? identity chain-loader)) | ||
| 145 | `(menu-entry (version 0) | ||
| 146 | (label ,label) | ||
| 147 | (device ,(device->sexp device)) | ||
| 148 | (device-mount-point ,mount-point) | ||
| 149 | (chain-loader ,chain-loader))))) | ||
| 138 | 150 | ||
| 139 | (define (sexp->menu-entry sexp) | 151 | (define (sexp->menu-entry sexp) |
| 140 | "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> | 152 | "Turn SEXP, an sexp as returned by 'menu-entry->sexp', into a <menu-entry> |
| @@ -171,7 +183,16 @@ record." | |||
| 171 | (device-mount-point mount-point) | 183 | (device-mount-point mount-point) |
| 172 | (multiboot-kernel multiboot-kernel) | 184 | (multiboot-kernel multiboot-kernel) |
| 173 | (multiboot-arguments multiboot-arguments) | 185 | (multiboot-arguments multiboot-arguments) |
| 174 | (multiboot-modules multiboot-modules))))) | 186 | (multiboot-modules multiboot-modules))) |
| 187 | (('menu-entry ('version 0) | ||
| 188 | ('label label) ('device device) | ||
| 189 | ('device-mount-point mount-point) | ||
| 190 | ('chain-loader chain-loader) _ ...) | ||
| 191 | (menu-entry | ||
| 192 | (label label) | ||
| 193 | (device (sexp->device device)) | ||
| 194 | (device-mount-point mount-point) | ||
| 195 | (chain-loader chain-loader))))) | ||
| 175 | 196 | ||
| 176 | 197 | ||
| 177 | ;;; | 198 | ;;; |
