fix(iso9660): copy actual efi config to efi structure

To keep things consistent, copy the EFI configuration also to the EFI structure on the ISO9660 filesystem.

Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
This commit is contained in:
desertwitch
2025-11-18 12:15:13 +01:00
parent 82ead30f72
commit 79d4185d69
2 changed files with 25 additions and 36 deletions

View File

@@ -99,6 +99,23 @@ config BR2_TARGET_ROOTFS_ISO9660_GRUB2_BOOT_MENU
will automatically be replaced by the path to the kernel and
initrd images respectively (or removed, if not applicable).
config BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU
string "Grub2 configuration file (EFI)"
depends on (BR2_TARGET_ROOTFS_ISO9660_GRUB2 || BR2_TARGET_ROOTFS_ISO9660_BOTH) \
&& BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER
default "fs/iso9660/efigrub.cfg"
help
Use this option to provide a custom GRUB2 configuration
file (grub.cfg), embedded both in the EFI partition and the
ISO9660 filesystem EFI-structure (for an EFI bootloader to find).
It will usually contain a "search" and "source" directive to find
the ISO9660 filesystem containing a common (BIOS) GRUB2 configuration.
Alternatively, 'set root=(cd0)' and other such quirks are possible here.
Note that any string __EFI_ID_FILE__ will automatically be
replaced with the BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE.
config BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE
string "Grub2 identification file (EFI)"
depends on (BR2_TARGET_ROOTFS_ISO9660_GRUB2 || BR2_TARGET_ROOTFS_ISO9660_BOTH) \
@@ -118,26 +135,6 @@ config BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_PARTITION_SIZE
Use this option to increase the size of the EFI partition.
Embedding more GRUB2 modules may require a larger EFI partition size.
config BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU
string "Grub2 embedded configuration (EFI)"
depends on (BR2_TARGET_ROOTFS_ISO9660_GRUB2 || BR2_TARGET_ROOTFS_ISO9660_BOTH) \
&& BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER
default "fs/iso9660/efigrub.cfg"
help
Use this option to provide a custom GRUB2 configuration
file (grub.cfg) that is embedded in the EFI paritition.
It will usually just contain a "search" directive to find the
ISO9660 filesystem containing the actual GRUB2 configuration file.
Alternatively, 'set root=(cd0)' could be directly set here also...
Note that the string __EFI_ID_FILE__ will automatically be
replaced with the BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE.
Do not mistake this for the regular GRUB2 configuration that is
eventually loaded by the EFI bootloader, this is just for systems
which need some extra help to locate the actual ISO9660 filesystem.
config BR2_TARGET_ROOTFS_ISO9660_INITRD
bool "Use initrd"
depends on !BR2_TARGET_ROOTFS_INITRAMFS

View File

@@ -135,15 +135,13 @@ ROOTFS_ISO9660_EFI_PARTITION = boot/efi.img
ROOTFS_ISO9660_EFI_PARTITION_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_EFI_PARTITION)
ROOTFS_ISO9660_EFI_PARTITION_CONTENT = $(BINARIES_DIR)/efi-part
ROOTFS_ISO9660_GRUB2_CONFIG_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/efigrub.cfg
ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/grub.cfg
define ROOTFS_ISO9660_INSTALL_GRUB2_EFI
# Create identification file to better find ISO9660 filesystem
# Create file to better find ISO9660 filesystem
$(INSTALL) -D -m 0644 /dev/null \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE)
# Copy grub.cfg to ISO9660 filesystem where GRUB will find it
$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_GRUB2_CONFIG_PATH) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/grub.cfg
# Copy EFI bootloader also to ISO9660 filesystem
$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/$(ROOTFS_ISO9660_EFI_NAME) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/$(ROOTFS_ISO9660_EFI_NAME)
# Create EFI FAT partition
@@ -158,11 +156,9 @@ define ROOTFS_ISO9660_INSTALL_GRUB2_EFI
# Delete the EFI bootloader that is NOT for the platform we're building for
$(HOST_DIR)/bin/mdel -i $(ROOTFS_ISO9660_EFI_PARTITION_PATH) \
::$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/$(ROOTFS_ISO9660_EFI_NOTNAME) || true
# Copy efigrub.cfg to EFI partition (may be used to find ISO9660 filesystem)
# Copy EFI configuration to EFI partition
$(HOST_DIR)/bin/mcopy -n -o -p -m -i $(ROOTFS_ISO9660_EFI_PARTITION_PATH) \
$(ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH) ::$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/grub.cfg
# Remove efigrub.cfg from ISO9660 filesystem, it was just there for SED-ing
rm -f $(ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH)
$(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
endef
@@ -223,7 +219,7 @@ ROOTFS_ISO9660_BOOT_IMAGE = isolinux/isolinux.bin
# GRUB2 EFI configuration
ROOTFS_ISO9660_GRUB2_CONFIG_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/efigrub.cfg
ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/grub.cfg
ROOTFS_ISO9660_EFI_PARTITION = boot/efi.img
ROOTFS_ISO9660_EFI_PARTITION_PATH = $(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_EFI_PARTITION)
ROOTFS_ISO9660_EFI_PARTITION_CONTENT = $(BINARIES_DIR)/efi-part
@@ -249,12 +245,10 @@ define ROOTFS_ISO9660_INSTALL_ISOLINUX_CONFIG
endef
define ROOTFS_ISO9660_INSTALL_GRUB2_EFI
# Create identification file to better find ISO9660 filesystem
# Create file to better find ISO9660 filesystem
$(INSTALL) -D -m 0644 /dev/null \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE)
# Copy grub.cfg to ISO9660 filesystem where GRUB will find it
$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_GRUB2_CONFIG_PATH) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/grub.cfg
# Copy EFI bootloader also to ISO9660 filesystem
$(INSTALL) -D -m 0644 $(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/$(ROOTFS_ISO9660_EFI_NAME) \
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/$(ROOTFS_ISO9660_EFI_NAME)
# Create EFI FAT partition
@@ -269,11 +263,9 @@ define ROOTFS_ISO9660_INSTALL_GRUB2_EFI
# Delete the EFI bootloader that is NOT for the platform we're building for
$(HOST_DIR)/bin/mdel -i $(ROOTFS_ISO9660_EFI_PARTITION_PATH) \
::$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/$(ROOTFS_ISO9660_EFI_NOTNAME) || true
# Copy efigrub.cfg to EFI partition (may be used to find ISO9660 filesystem)
# Copy EFI configuration to EFI partition
$(HOST_DIR)/bin/mcopy -n -o -p -m -i $(ROOTFS_ISO9660_EFI_PARTITION_PATH) \
$(ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH) ::$(ROOTFS_ISO9660_GRUB2_EFI_PREFIX)/grub.cfg
# Remove efigrub.cfg from ISO9660 filesystem, it was just there for SED-ing
rm -f $(ROOTFS_ISO9660_GRUB2_EFI_CONFIG_PATH)
$(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
endef