aboutsummaryrefslogtreecommitdiff
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)
downloadguix-62c86c8391ceb8953ca972498fd75ea9298b85ff.tar.gz
guix-62c86c8391ceb8953ca972498fd75ea9298b85ff.zip
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 65d7171432..4f18c9b518 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
;;; Copyright © 2022 Karl Hallsby <karl@hallsby.com>
+;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -57,6 +58,7 @@
grub-bootloader
grub-efi-bootloader
grub-efi-removable-bootloader
+ grub-efi32-bootloader
grub-efi-netboot-bootloader
grub-mkrescue-bootloader
grub-minimal-bootloader
@@ -636,6 +638,29 @@ fi~%"))))
"--bootloader-id=Guix"
"--efi-directory" target-esp)))))
+(define install-grub-efi32
+ #~(lambda (bootloader efi-dir mount-point)
+ ;; There is nothing useful to do when called in the context of a disk
+ ;; image generation.
+ (when efi-dir
+ ;; Install GRUB onto the EFI partition mounted at EFI-DIR, for the
+ ;; system whose root is mounted at MOUNT-POINT.
+ (let ((grub-install (string-append bootloader "/sbin/grub-install"))
+ (install-dir (string-append mount-point "/boot"))
+ ;; When installing Guix, it's common to mount EFI-DIR below
+ ;; MOUNT-POINT rather than /boot/efi on the live image.
+ (target-esp (if (file-exists? (string-append mount-point efi-dir))
+ (string-append mount-point efi-dir)
+ efi-dir)))
+ ;; Tell 'grub-install' that there might be a LUKS-encrypted /boot or
+ ;; root partition.
+ (setenv "GRUB_ENABLE_CRYPTODISK" "y")
+ (invoke/quiet grub-install "--boot-directory" install-dir
+ "--bootloader-id=Guix"
+ (cond ((target-x86?) "--target=i386-efi")
+ ((target-arm?) "--target=arm-efi"))
+ "--efi-directory" target-esp)))))
+
(define (install-grub-efi-netboot subdir)
"Define a grub-efi-netboot bootloader installer for installation in SUBDIR,
which is usually efi/Guix or efi/boot."
@@ -768,6 +793,13 @@ considered for security aspects."
(name 'grub-efi-removable-bootloader)
(installer install-grub-efi-removable)))
+(define grub-efi32-bootloader
+ (bootloader
+ (inherit grub-efi-bootloader)
+ (installer install-grub-efi32)
+ (name 'grub-efi32)
+ (package grub-efi32)))
+
(define grub-efi-netboot-bootloader
(bootloader
(inherit grub-efi-bootloader)