gnu: bootloader: grub: Add support for chain-loader.

* gnu/bootloader/grub.scm (grub-configuration-file): Add support for
chain-loader.

Signed-off-by: Julien Lepiller <julien@lepiller.eu>
This commit is contained in:
tiantian 2022-09-05 01:25:40 +08:00 committed by Julien Lepiller
parent 52d780ea2b
commit 1fc20e4c86
No known key found for this signature in database
GPG key ID: 53D457B2D636EE82

View file

@ -374,8 +374,11 @@ (define (menu-entry->gexp entry)
(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
(device-mount-point (menu-entry-device-mount-point entry))
(multiboot-kernel (menu-entry-multiboot-kernel entry))
(chain-loader (menu-entry-chain-loader entry)))
(cond
(linux
(let ((arguments (menu-entry-linux-arguments entry))
(linux (normalize-file linux
device-mount-point
@ -398,7 +401,8 @@ (define (menu-entry->gexp entry)
#$label
#$(grub-root-search device linux)
#$linux (string-join (list #$@arguments))
#$initrd))
#$initrd)))
(multiboot-kernel
(let ((kernel (menu-entry-multiboot-kernel entry))
(arguments (menu-entry-multiboot-arguments entry))
(modules (menu-entry-multiboot-modules entry))
@ -411,7 +415,16 @@ (define (menu-entry->gexp entry)
#$kernel
#$root-index (string-join (list #$@arguments) " " 'prefix)
(string-join (map string-join '#$modules)
"\n module " 'prefix))))))
"\n module " 'prefix))))
(chain-loader
#~(format port "
menuentry ~s {
~a
chainloader ~a
}~%"
#$label
#$(grub-root-search device chain-loader)
#$chain-loader)))))
(define (crypto-devices)
(define (crypto-device->cryptomount dev)