fs/iso9660: add support for hybrid image using Grub2 on BIOS and EFI
Add support for building an hybrid ISO9660 image compatible with legacy and UEFI BIOS. Note that this is not about an (iso)hybrid image, which can boot from both a CDROM or a USB stick, but really about an image being bootable from the legay BIOS or EFI; the two are orthognal. The option -eltorito-alt-boot need to be used in the xorriso command to generate the hybrid image. That option is a separator, meaning the previous boot entry is done, and the following boot options define a new boot entry. The -no-emul-boot defines the type of the current boot image; that's why it has to now be repeated in each of the BIOS and EFI options. Finally, for symetry and consistency between the BIOS and EFI options, we move the BIOS image option first. Note: the BIOS boot image options have to be provided before the EFI ones, or the system won't boot; the underlying reason is not known... Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> [yann.morin.1998@free.fr: - note about hybrid vs. (iso)hybrid - explain -eltorito-alt-boot - explain duplication of -no-emul-boot - rename the variables - note about the BIOS-EFI ordering ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
3b1659107d
commit
5916cc5011
@ -27,6 +27,10 @@ choice
|
||||
config BR2_TARGET_ROOTFS_ISO9660_GRUB2
|
||||
bool "grub2"
|
||||
depends on BR2_TARGET_GRUB2
|
||||
select BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER \
|
||||
if BR2_TARGET_GRUB2_I386_PC
|
||||
select BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER \
|
||||
if (BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI)
|
||||
help
|
||||
Use Grub 2 as the bootloader for the ISO9660 image. Make
|
||||
sure to enable the 'iso9660' module in
|
||||
@ -39,21 +43,15 @@ config BR2_TARGET_ROOTFS_ISO9660_GRUB2
|
||||
config BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
|
||||
bool "isolinux"
|
||||
depends on BR2_TARGET_SYSLINUX_ISOLINUX
|
||||
select BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "Boot payload"
|
||||
|
||||
config BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER
|
||||
bool "legacy bios"
|
||||
depends on BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_ROOTFS_ISO9660_ISOLINUX
|
||||
bool
|
||||
|
||||
config BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER
|
||||
bool "UEFI"
|
||||
depends on BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI
|
||||
|
||||
endchoice
|
||||
bool
|
||||
|
||||
config BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU
|
||||
string "Boot menu config file"
|
||||
|
@ -69,18 +69,20 @@ ROOTFS_ISO9660_DEPENDENCIES += grub2
|
||||
ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
|
||||
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
|
||||
ROOTFS_ISO9660_BOOT_IMAGE = boot/grub/grub-eltorito.img
|
||||
define ROOTFS_ISO9660_INSTALL_BOOTLOADER
|
||||
define ROOTFS_ISO9660_INSTALL_BOOTLOADER_BIOS
|
||||
$(INSTALL) -D -m 0644 $(BINARIES_DIR)/grub-eltorito.img \
|
||||
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub-eltorito.img
|
||||
endef
|
||||
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2)$(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),yy)
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_GRUB2)$(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),yy)
|
||||
ROOTFS_ISO9660_DEPENDENCIES += grub2 host-dosfstools host-mtools
|
||||
ROOTFS_ISO9660_EFI_PARTITION = boot/fat.efi
|
||||
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_BOOTLOADER_CONFIG_PATH = \
|
||||
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/boot/grub/grub.cfg
|
||||
define ROOTFS_ISO9660_INSTALL_BOOTLOADER
|
||||
define ROOTFS_ISO9660_INSTALL_BOOTLOADER_EFI
|
||||
rm -rf $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
|
||||
mkdir -p $(dir $(ROOTFS_ISO9660_EFI_PARTITION_PATH))
|
||||
dd if=/dev/zero of=$(ROOTFS_ISO9660_EFI_PARTITION_PATH) bs=1M count=1
|
||||
@ -90,12 +92,14 @@ define ROOTFS_ISO9660_INSTALL_BOOTLOADER
|
||||
$(ROOTFS_ISO9660_EFI_PARTITION_CONTENT)/* ::/
|
||||
$(ROOTFS_ISO9660_FIX_TIME) $(ROOTFS_ISO9660_EFI_PARTITION_PATH)
|
||||
endef
|
||||
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_ISOLINUX),y)
|
||||
ROOTFS_ISO9660_DEPENDENCIES += syslinux
|
||||
ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH = \
|
||||
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/isolinux/isolinux.cfg
|
||||
ROOTFS_ISO9660_BOOT_IMAGE = isolinux/isolinux.bin
|
||||
define ROOTFS_ISO9660_INSTALL_BOOTLOADER
|
||||
define ROOTFS_ISO9660_INSTALL_BOOTLOADER_BIOS
|
||||
$(INSTALL) -D -m 0644 $(BINARIES_DIR)/syslinux/* \
|
||||
$(ROOTFS_ISO9660_TMP_TARGET_DIR)/isolinux/
|
||||
$(INSTALL) -D -m 0644 $(HOST_DIR)/share/syslinux/ldlinux.c32 \
|
||||
@ -108,7 +112,8 @@ define ROOTFS_ISO9660_PREPARATION
|
||||
$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
|
||||
$(SED) "s%__KERNEL_PATH__%/boot/$(LINUX_IMAGE_NAME)%" \
|
||||
$(ROOTFS_ISO9660_BOOTLOADER_CONFIG_PATH)
|
||||
$(ROOTFS_ISO9660_INSTALL_BOOTLOADER)
|
||||
$(ROOTFS_ISO9660_INSTALL_BOOTLOADER_BIOS)
|
||||
$(ROOTFS_ISO9660_INSTALL_BOOTLOADER_EFI)
|
||||
endef
|
||||
|
||||
ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_PREPARATION
|
||||
@ -152,21 +157,27 @@ ROOTFS_ISO9660_PRE_GEN_HOOKS += ROOTFS_ISO9660_DISABLE_EXTERNAL_INITRD
|
||||
|
||||
endif # ROOTFS_ISO9660_USE_INITRD
|
||||
|
||||
ROOTFS_ISO9660_OPTS += \
|
||||
-J \
|
||||
-R \
|
||||
ROOTFS_ISO9660_OPTS += -J -R
|
||||
|
||||
ROOTFS_ISO9660_OPTS_BIOS = \
|
||||
-b $(ROOTFS_ISO9660_BOOT_IMAGE) \
|
||||
-no-emul-boot \
|
||||
-boot-load-size 4 \
|
||||
-boot-info-table
|
||||
|
||||
ROOTFS_ISO9660_OPTS_EFI = \
|
||||
--efi-boot $(ROOTFS_ISO9660_EFI_PARTITION) \
|
||||
-no-emul-boot
|
||||
|
||||
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER),y)
|
||||
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER)$(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),yy)
|
||||
ROOTFS_ISO9660_OPTS += \
|
||||
-boot-load-size 4 \
|
||||
-boot-info-table \
|
||||
-b $(ROOTFS_ISO9660_BOOT_IMAGE)
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),y)
|
||||
ROOTFS_ISO9660_OPTS += \
|
||||
--efi-boot $(ROOTFS_ISO9660_EFI_PARTITION)
|
||||
$(ROOTFS_ISO9660_OPTS_BIOS) \
|
||||
-eltorito-alt-boot \
|
||||
$(ROOTFS_ISO9660_OPTS_EFI)
|
||||
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_BIOS_BOOTLOADER),y)
|
||||
ROOTFS_ISO9660_OPTS += $(ROOTFS_ISO9660_OPTS_BIOS)
|
||||
else ifeq ($(BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER),y)
|
||||
ROOTFS_ISO9660_OPTS += $(ROOTFS_ISO9660_OPTS_EFI)
|
||||
endif
|
||||
|
||||
define ROOTFS_ISO9660_CMD
|
||||
|
Loading…
Reference in New Issue
Block a user