1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-28 21:20:29 +02:00

image: Supply grub-efi from esp partition initializer.

Instead of passing down grub-efi in system-disk-image,
pass it down only where it's necessary - in esp partitions.

Since the esp partitions are only for grub, I renamed them
so that it's more clear to future users of them. They
do not check the bootloader of os at all, they always
initialize grub.

Followup of 1dfe1ebdf6,
fixing regression for mbr-hybrid images.

Fixes: #4538.

* guix/system/image.scm
(esp-partition/grub): Rename from esp-partition; Pass grub-efi to
initialize-efi-partition.
(esp32-partition/grub): Rename from esp32-partition; Pass grub32-efi to
initialize-efi-partition.
(esp-partition, (esp32-partition): Deprecate.
(system-disk-image): Do not supply grub-efi arguments.

Change-Id: I336c3144e8efc3ce872031e631d64d3708546ff8
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
This commit is contained in:
Rutherther
2025-11-29 13:36:37 +01:00
committed by Efraim Flashner
parent 011a3b932d
commit ca0ed91b40

View File

@@ -23,6 +23,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu system image) (define-module (gnu system image)
#:use-module (guix deprecation)
#:use-module (guix diagnostics) #:use-module (guix diagnostics)
#:use-module (guix discovery) #:use-module (guix discovery)
#:use-module (guix gexp) #:use-module (guix gexp)
@@ -74,9 +75,12 @@
image-without-os image-without-os
operating-system-for-image operating-system-for-image
esp-partition/grub
esp32-partition/grub
root-partition
esp-partition esp-partition
esp32-partition esp32-partition
root-partition
mbr-disk-image mbr-disk-image
mbr-hybrid-disk-image mbr-hybrid-disk-image
@@ -125,21 +129,28 @@
parent image record." parent image record."
(image (operating-system #false) . fields)) (image (operating-system #false) . fields))
(define esp-partition (define esp-partition/grub
(partition (partition
(size (* 40 (expt 2 20))) (size (* 40 (expt 2 20)))
(offset root-offset) (offset root-offset)
(label "GNU-ESP") ;cosmetic only (label "GNU-ESP") ;cosmetic only
;; Use "vfat" here since this property is used when mounting. The actual ;; Use "vfat" here since this property is used when mounting. The actual
;; FAT-ness is based on file system size (16 in this case). ;; FAT-ness is based on file system size (16 in this case).
(file-system "vfat") (file-system "vfat")
(flags '(esp)) (flags '(esp))
(initializer (gexp initialize-efi-partition)))) (initializer #~(lambda* (root #:key #:allow-other-keys)
(initialize-efi-partition root #:grub-efi #+grub-efi)))))
(define esp32-partition (define esp32-partition/grub
(partition (partition
(inherit esp-partition) (inherit esp-partition/grub)
(initializer (gexp initialize-efi32-partition)))) (initializer #~(lambda* (root #:key #:allow-other-keys)
(initialize-efi32-partition #:grub-efi32 #+grub-efi32)))))
;; Be more transparent. The esp partition unconditinally installs grub.
;; It doesn't look up bootloader of the system.
(define-deprecated/public-alias esp-partition esp-partition/grub)
(define-deprecated/public-alias esp32-partition esp32-partition/grub)
(define root-partition (define root-partition
(partition (partition
@@ -166,19 +177,19 @@ parent image record."
(format 'disk-image) (format 'disk-image)
(partition-table-type 'mbr) (partition-table-type 'mbr)
(partitions (partitions
(list esp-partition root-partition)))) (list esp-partition/grub root-partition))))
(define efi-disk-image (define efi-disk-image
(image-without-os (image-without-os
(format 'disk-image) (format 'disk-image)
(partition-table-type 'gpt) (partition-table-type 'gpt)
(partitions (list esp-partition root-partition)))) (partitions (list esp-partition/grub root-partition))))
(define efi32-disk-image (define efi32-disk-image
(image-without-os (image-without-os
(format 'disk-image) (format 'disk-image)
(partition-table-type 'gpt) (partition-table-type 'gpt)
(partitions (list esp32-partition root-partition)))) (partitions (list esp32-partition/grub root-partition))))
(define iso9660-image (define iso9660-image
(image-without-os (image-without-os
@@ -501,15 +512,6 @@ used in the image."
#:copy-closures? (not #:copy-closures? (not
#$(image-shared-store? image)) #$(image-shared-store? image))
#:system-directory #$os #:system-directory #$os
;; These two shouldn't be needed unconditionally.
#:grub-efi
#+(if (bootloader-uses-grub-efi? bootloader)
grub-efi
#f)
#:grub-efi32
#+(if (bootloader-uses-grub-efi? bootloader)
grub-efi32
#f)
#:bootloader-package #:bootloader-package
#+(bootloader-package bootloader) #+(bootloader-package bootloader)
#:bootloader-installer #:bootloader-installer