summaryrefslogtreecommitdiff
path: root/gnu/bootloader
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2022-06-17 23:18:35 -0600
committerMathieu Othacehe <othacehe@gnu.org>2022-06-24 10:21:06 +0200
commit62c86c8391ceb8953ca972498fd75ea9298b85ff (patch)
treef4ddcdf3749219c0fd36b92d0c2ba52b73566a07 /gnu/bootloader
parent242fad357e969da3b1f80b7e4360b54d99ee03f3 (diff)
image: Add support for 32bit UEFI.
* gnu/bootloader/grub.scm (grub-efi32-bootloader): New variable. (install-grub-efi32): New variable. * gnu/build/bootloader.scm (install-efi): Add a 'targets' keyword argument. (install-efi-loader): Likewise. * gnu/build/image.scm (initialize-efi32-partition): New procedure. * gnu/packages/bootloaders.scm (grub-efi32): New variable. * gnu/system/image.scm (esp32-partition): New variable (efi32-disk-image): New variable. (efi32-raw-image-type): New variable. (system-disk-image)[partition-image]: Set '#:grub-efi32' when calling the partition initializer. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/bootloader')
-rw-r--r--gnu/bootloader/grub.scm32
1 files changed, 32 insertions, 0 deletions
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 65d7171432c..4f18c9b5183 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -8,6 +8,7 @@
8;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> 8;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
9;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de> 9;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
10;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com> 10;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
11;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
11;;; 12;;;
12;;; This file is part of GNU Guix. 13;;; This file is part of GNU Guix.
13;;; 14;;;
@@ -57,6 +58,7 @@
57 grub-bootloader 58 grub-bootloader
58 grub-efi-bootloader 59 grub-efi-bootloader
59 grub-efi-removable-bootloader 60 grub-efi-removable-bootloader
61 grub-efi32-bootloader
60 grub-efi-netboot-bootloader 62 grub-efi-netboot-bootloader
61 grub-mkrescue-bootloader 63 grub-mkrescue-bootloader
62 grub-minimal-bootloader 64 grub-minimal-bootloader
@@ -636,6 +638,29 @@ fi~%"))))
636 "--bootloader-id=Guix" 638 "--bootloader-id=Guix"
637 "--efi-directory" target-esp))))) 639 "--efi-directory" target-esp)))))
638 640
641(define install-grub-efi32
642 #~(lambda (bootloader efi-dir mount-point)
643 ;; There is nothing useful to do when called in the context of a disk
644 ;; image generation.
645 (when efi-dir
646 ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
647 ;; system whose root is mounted at MOUNT-POINT.
648 (let ((grub-install (string-append bootloader "/sbin/grub-install"))
649 (install-dir (string-append mount-point "/boot"))
650 ;; When installing Guix, it's common to mount EFI-DIR below
651 ;; MOUNT-POINT rather than /boot/efi on the live image.
652 (target-esp (if (file-exists? (string-append mount-point efi-dir))
653 (string-append mount-point efi-dir)
654 efi-dir)))
655 ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
656 ;; root partition.
657 (setenv "GRUB_ENABLE_CRYPTODISK" "y")
658 (invoke/quiet grub-install "--boot-directory" install-dir
659 "--bootloader-id=Guix"
660 (cond ((target-x86?) "--target=i386-efi")
661 ((target-arm?) "--target=arm-efi"))
662 "--efi-directory" target-esp)))))
663
639(define (install-grub-efi-netboot subdir) 664(define (install-grub-efi-netboot subdir)
640 "Define a grub-efi-netboot bootloader installer for installation in SUBDIR, 665 "Define a grub-efi-netboot bootloader installer for installation in SUBDIR,
641which is usually efi/Guix or efi/boot." 666which is usually efi/Guix or efi/boot."
@@ -768,6 +793,13 @@ considered for security aspects."
768 (name 'grub-efi-removable-bootloader) 793 (name 'grub-efi-removable-bootloader)
769 (installer install-grub-efi-removable))) 794 (installer install-grub-efi-removable)))
770 795
796(define grub-efi32-bootloader
797 (bootloader
798 (inherit grub-efi-bootloader)
799 (installer install-grub-efi32)
800 (name 'grub-efi32)
801 (package grub-efi32)))
802
771(define grub-efi-netboot-bootloader 803(define grub-efi-netboot-bootloader
772 (bootloader 804 (bootloader
773 (inherit grub-efi-bootloader) 805 (inherit grub-efi-bootloader)