summaryrefslogtreecommitdiff
path: root/gnu/bootloader
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-11-11 14:48:54 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-11-17 15:20:03 -0500
commitb0afa3c5f6fc3dc84779be64d03cdff4ab295a33 (patch)
treeb0541df4d5dca210663a45c89b169f50ea2b96eb /gnu/bootloader
parent1ec366cdfd92e4913ab7d1096520410272e3c89c (diff)
bootloader: grub: Skip install-grub-efi when producing a disk image.
Fixes <http://issues.guix.gnu.org/44353>. Every bootloader should try their best to install themselves using only the MOUNT-POINT and otherwise do nothing. This requirement comes from the necessity to call INSTALL-GRUB when installing the (non-EFI) GRUB bootloader, which needs to populate the root file system with extra modules that cannot be fit in the core.img file, limited in size to 491520 bytes (by the i386-pc format required for legacy BIOS compatibility). As introducing bootloader knowledge at the level of the image code is undesirable, every bootloader should be adapted to support this fall-back for their installation procedure (TODO). * gnu/bootloader/grub.scm (install-grub-efi)[efi-dir]: Skip when the EFI-DIR argument is set to #f.
Diffstat (limited to 'gnu/bootloader')
-rw-r--r--gnu/bootloader/grub.scm33
1 files changed, 18 insertions, 15 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 0899fab61fa..af7b7561ff0 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -573,21 +573,24 @@ fi~%"))))
573 573
574(define install-grub-efi 574(define install-grub-efi
575 #~(lambda (bootloader efi-dir mount-point) 575 #~(lambda (bootloader efi-dir mount-point)
576 ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the 576 ;; There is nothing useful to do when called in the context of a disk
577 ;; system whose root is mounted at MOUNT-POINT. 577 ;; image generation.
578 (let ((grub-install (string-append bootloader "/sbin/grub-install")) 578 (when efi-dir
579 (install-dir (string-append mount-point "/boot")) 579 ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
580 ;; When installing Guix, it's common to mount EFI-DIR below 580 ;; system whose root is mounted at MOUNT-POINT.
581 ;; MOUNT-POINT rather than /boot/efi on the live image. 581 (let ((grub-install (string-append bootloader "/sbin/grub-install"))
582 (target-esp (if (file-exists? (string-append mount-point efi-dir)) 582 (install-dir (string-append mount-point "/boot"))
583 (string-append mount-point efi-dir) 583 ;; When installing Guix, it's common to mount EFI-DIR below
584 efi-dir))) 584 ;; MOUNT-POINT rather than /boot/efi on the live image.
585 ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or 585 (target-esp (if (file-exists? (string-append mount-point efi-dir))
586 ;; root partition. 586 (string-append mount-point efi-dir)
587 (setenv "GRUB_ENABLE_CRYPTODISK" "y") 587 efi-dir)))
588 (invoke/quiet grub-install "--boot-directory" install-dir 588 ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
589 "--bootloader-id=Guix" 589 ;; root partition.
590 "--efi-directory" target-esp)))) 590 (setenv "GRUB_ENABLE_CRYPTODISK" "y")
591 (invoke/quiet grub-install "--boot-directory" install-dir
592 "--bootloader-id=Guix"
593 "--efi-directory" target-esp)))))
591 594
592(define (install-grub-efi-netboot subdir) 595(define (install-grub-efi-netboot subdir)
593 "Define a grub-efi-netboot bootloader installer for installation in SUBDIR, 596 "Define a grub-efi-netboot bootloader installer for installation in SUBDIR,