From 66e7c16de39e7e596e7819d208cdd58bc968c393 Mon Sep 17 00:00:00 2001 From: desertwitch <24509509+desertwitch@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:25:07 +0100 Subject: [PATCH] fix: embed grub finder configuration Helps GRUB find the ShredOS volume when it otherwise cannot (such as when the IMG is used with Ventoy in BIOS) Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com> --- board/shredos/embed/README | 16 ++++++++++++++++ board/shredos/embed/grub.cfg | 3 +++ board/shredos/genimage.cfg | 1 + board/shredos/genimage_i586.cfg | 1 + configs/shredos_defconfig | 2 ++ configs/shredos_i586_defconfig | 2 ++ configs/shredos_img_defconfig | 3 ++- configs/shredos_img_i586_defconfig | 3 ++- configs/shredos_iso_aio_defconfig | 1 + configs/shredos_iso_aio_i586_defconfig | 1 + configs/shredos_iso_defconfig | 2 +- configs/shredos_iso_i586_defconfig | 2 +- fs/iso9660/Config.in | 2 +- 13 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 board/shredos/embed/README create mode 100644 board/shredos/embed/grub.cfg diff --git a/board/shredos/embed/README b/board/shredos/embed/README new file mode 100644 index 0000000000..13ef99752d --- /dev/null +++ b/board/shredos/embed/README @@ -0,0 +1,16 @@ +This file is embedded into the GRUB bootloaders at build-time +Helps GRUB find our ShredOS volume when it cannot (Ventoy BIOS) +There is no point to put it anywhere on the USB - so don't do that. + +Keep consistent with BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE +when building any configurations that build both an ISO and the IMG. + +Do not use the version file as identification file though, because +the ISO9660 filesystem does not have it (but has the needed grub.cfg), +so you should always use a unique file not otherwise used for anything. + +Also ensure it is in a location where users cannot delete it by accident. + +Note that contrary to the GNU manual the BIOS bootloader seems to need an +explicit "configfile" directive, otherwise the Buildroot static prefix takes +precedence over the actual found volume path (which may be entirely different). diff --git a/board/shredos/embed/grub.cfg b/board/shredos/embed/grub.cfg new file mode 100644 index 0000000000..c036fc5671 --- /dev/null +++ b/board/shredos/embed/grub.cfg @@ -0,0 +1,3 @@ +search --file --set=root /boot/buildroot +set prefix=($root)/boot/grub +configfile $prefix/grub.cfg diff --git a/board/shredos/genimage.cfg b/board/shredos/genimage.cfg index 2d6e121872..27e9a77ee2 100644 --- a/board/shredos/genimage.cfg +++ b/board/shredos/genimage.cfg @@ -4,6 +4,7 @@ image boot.vfat { file boot/bzImage { image = 'bzImage' } file boot/grub/grub.cfg { image = 'grub.cfg' } file boot/version.txt { image = 'version.txt' } + file boot/buildroot { image = '/dev/null' } file EFI/BOOT/bootx64.efi { image = 'bootx64.efi' } file EFI/BOOT/grub.cfg { image = 'grub.cfg' } file shredos.ico { image = 'shredos.ico' } diff --git a/board/shredos/genimage_i586.cfg b/board/shredos/genimage_i586.cfg index 9f1cf73d15..97182ed8e7 100644 --- a/board/shredos/genimage_i586.cfg +++ b/board/shredos/genimage_i586.cfg @@ -4,6 +4,7 @@ image boot.vfat { file boot/bzImage { image = 'bzImage' } file boot/grub/grub.cfg { image = 'grub.cfg' } file boot/version.txt { image = 'version.txt' } + file boot/buildroot { image = '/dev/null' } file EFI/BOOT/bootia32.efi { image = 'bootia32.efi' } file EFI/BOOT/grub.cfg { image = 'grub.cfg' } file shredos.ico { image = 'shredos.ico' } diff --git a/configs/shredos_defconfig b/configs/shredos_defconfig index 43459568da..400e03cbfa 100644 --- a/configs/shredos_defconfig +++ b/configs/shredos_defconfig @@ -175,7 +175,9 @@ BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_I386_PC=y BR2_TARGET_GRUB2_X86_64_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat squash4 part_msdos part_gpt normal progress biosdisk all_video video_cirrus video_bochs net tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile iso9660" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_TARGET_SYSLINUX=y BR2_PACKAGE_HOST_E2FSPROGS=y diff --git a/configs/shredos_i586_defconfig b/configs/shredos_i586_defconfig index f13fac1826..5aff8e35c9 100644 --- a/configs/shredos_i586_defconfig +++ b/configs/shredos_i586_defconfig @@ -172,7 +172,9 @@ BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_I386_PC=y BR2_TARGET_GRUB2_I386_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat squash4 part_msdos part_gpt normal progress biosdisk all_video video_cirrus video_bochs net tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile iso9660" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_TARGET_SYSLINUX=y BR2_PACKAGE_HOST_E2FSPROGS=y diff --git a/configs/shredos_img_defconfig b/configs/shredos_img_defconfig index 11bbe26be7..f175c3149d 100644 --- a/configs/shredos_img_defconfig +++ b/configs/shredos_img_defconfig @@ -165,13 +165,14 @@ BR2_PACKAGE_UTIL_LINUX_SU=y BR2_PACKAGE_UTIL_LINUX_SULOGIN=y BR2_TARGET_ROOTFS_CPIO_LZMA=y BR2_TARGET_ROOTFS_INITRAMFS=y -# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_I386_PC=y BR2_TARGET_GRUB2_X86_64_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat squash4 part_msdos part_gpt normal progress biosdisk all_video video_cirrus video_bochs net tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_PACKAGE_HOST_E2FSPROGS=y BR2_PACKAGE_HOST_GENIMAGE=y diff --git a/configs/shredos_img_i586_defconfig b/configs/shredos_img_i586_defconfig index c418514d36..079281d7cc 100644 --- a/configs/shredos_img_i586_defconfig +++ b/configs/shredos_img_i586_defconfig @@ -162,13 +162,14 @@ BR2_PACKAGE_UTIL_LINUX_SU=y BR2_PACKAGE_UTIL_LINUX_SULOGIN=y BR2_TARGET_ROOTFS_CPIO_LZMA=y BR2_TARGET_ROOTFS_INITRAMFS=y -# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_I386_PC=y BR2_TARGET_GRUB2_I386_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_PC="boot linux ext2 fat squash4 part_msdos part_gpt normal progress biosdisk all_video video_cirrus video_bochs net tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_PACKAGE_HOST_E2FSPROGS=y BR2_PACKAGE_HOST_GENIMAGE=y diff --git a/configs/shredos_iso_aio_defconfig b/configs/shredos_iso_aio_defconfig index 9c79632d01..f89683d4bf 100644 --- a/configs/shredos_iso_aio_defconfig +++ b/configs/shredos_iso_aio_defconfig @@ -174,6 +174,7 @@ BR2_TARGET_ROOTFS_ISO9660_HYBRID=y BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_X86_64_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile iso9660" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_TARGET_SYSLINUX=y BR2_PACKAGE_HOST_E2FSPROGS=y diff --git a/configs/shredos_iso_aio_i586_defconfig b/configs/shredos_iso_aio_i586_defconfig index c2a97f0012..ca49461e43 100644 --- a/configs/shredos_iso_aio_i586_defconfig +++ b/configs/shredos_iso_aio_i586_defconfig @@ -171,6 +171,7 @@ BR2_TARGET_ROOTFS_ISO9660_HYBRID=y BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_I386_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile iso9660" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_TARGET_SYSLINUX=y BR2_PACKAGE_HOST_E2FSPROGS=y diff --git a/configs/shredos_iso_defconfig b/configs/shredos_iso_defconfig index 8c16310216..e65a954f22 100644 --- a/configs/shredos_iso_defconfig +++ b/configs/shredos_iso_defconfig @@ -167,12 +167,12 @@ BR2_TARGET_ROOTFS_CPIO_LZMA=y BR2_TARGET_ROOTFS_INITRAMFS=y BR2_TARGET_ROOTFS_ISO9660=y BR2_TARGET_ROOTFS_ISO9660_BOTH=y -# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_X86_64_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile iso9660" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_TARGET_SYSLINUX=y BR2_PACKAGE_HOST_E2FSPROGS=y diff --git a/configs/shredos_iso_i586_defconfig b/configs/shredos_iso_i586_defconfig index d1cd8a7802..31679e715b 100644 --- a/configs/shredos_iso_i586_defconfig +++ b/configs/shredos_iso_i586_defconfig @@ -164,12 +164,12 @@ BR2_TARGET_ROOTFS_CPIO_LZMA=y BR2_TARGET_ROOTFS_INITRAMFS=y BR2_TARGET_ROOTFS_ISO9660=y BR2_TARGET_ROOTFS_ISO9660_BOTH=y -# BR2_TARGET_ROOTFS_ISO9660_INITRD is not set BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_I386_EFI=y BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI="boot linux ext2 fat squash4 part_msdos part_gpt normal progress efi_gop efi_uga all_video video_cirrus video_bochs net efinet tftp gzio test eval read true gfxterm gfxterm_menu gfxmenu gfxterm_background png usb usb_keyboard search configfile iso9660" +BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI="board/shredos/embed/grub.cfg" BR2_TARGET_GRUB2_INSTALL_TOOLS=y BR2_TARGET_SYSLINUX=y BR2_PACKAGE_HOST_E2FSPROGS=y diff --git a/fs/iso9660/Config.in b/fs/iso9660/Config.in index b26735b02b..1e2424db2b 100644 --- a/fs/iso9660/Config.in +++ b/fs/iso9660/Config.in @@ -120,7 +120,7 @@ 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) \ && BR2_TARGET_ROOTFS_ISO9660_EFI_BOOTLOADER - default "/buildroot" + default "/boot/buildroot" help Use this option to provide a custom name for the identification file that is added to the ISO9660 filesystem, so the EFI bootloader