From 1635894f8ee55f44d2caeca4c973b684adf75084 Mon Sep 17 00:00:00 2001 From: desertwitch <24509509+desertwitch@users.noreply.github.com> Date: Fri, 21 Nov 2025 10:36:33 +0100 Subject: [PATCH] fix(configs): revert partition size and post processing for EFI The EFI partition for hybrid ISOs does not reliably show on all Windows systems, so we cannot use our "hack" of writing the configurations/PDFs to it. Reverted instead to a sane-sized EFI partition which is used just for booting. Added a note to the README that some tools such as Rufus support an ISO-mode to add a writeable partition at burning-time. Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com> --- README.md | 30 ++++++++++--------- board/shredos/README-ISO.txt | 5 ---- .../usr/bin/find_shredos_boot_disc.sh | 18 ++--------- board/shredos/populate_efi_partition.sh | 25 ---------------- configs/shredos_defconfig | 2 -- configs/shredos_i586_defconfig | 2 -- configs/shredos_iso_defconfig | 2 -- configs/shredos_iso_i586_defconfig | 2 -- fs/iso9660/Config.in | 12 +++++--- 9 files changed, 27 insertions(+), 71 deletions(-) delete mode 100644 board/shredos/README-ISO.txt delete mode 100755 board/shredos/populate_efi_partition.sh diff --git a/README.md b/README.md index 69e154fe50..d44942aefd 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ NOTE! There may be pre-release versions that are newer than the latest versions ### For all releases including latest and more recent pre-releases [releases](https://github.com/PartialVolume/shredos.x86_64/releases) -Note for versions **after** _v2024.11_27_x86-64_0.38_: The .img files for burning to USB flash drives support both BIOS/UEFI booting, as well as saving of generated PDF reports to the USB flash drive. The .iso image also supports both BIOS/UEFI booting, burning to USB flash drives and CD/DVD-ROM, as well as saving of generated PDF reports to USB flash drive (if being written to one). But use the .img file whenever planning to customize ShredOS (`autonuke` setups, kernel parameters, ...), as it will allow direct permanent modification of the GRUB boot menu and appending of kernel parameters, which the .iso file does not support due to filesystem constraints. +Note for versions **after** _v2024.11_27_x86-64_0.38_: The .img files for burning to USB flash drives support both BIOS/UEFI booting, as well as saving of generated PDF reports to the USB flash drive. The .iso image also supports both BIOS/UEFI booting, burning to USB flash drives and CD/DVD-ROM, but not saving of generated PDF reports to the own USB flash drive (unless being written in "ISO-Mode" with some tools, such as Rufus). Use the .img file whenever needing these generated PDF reports or planning to customize ShredOS (`autonuke` setups, kernel parameters, ...). The .img file allows direct interaction with the filesystem and modification of the GRUB boot menu, e.g. appending of kernel parameters, which the .iso file does not support due to filesystem constraints. Note for versions **until** _v2024.11_27_x86-64_0.38_: The .img files for burning to USB flash drives support both BIOS/UEFI booting. The .iso image supports legacy BIOS booting only and not UEFI, however, a BIOS/UEFI version of the .iso is available in newer ShredOS versions. You can also consider [VENTOY (Open Source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files)](https://github.com/ventoy/Ventoy) as a workaround to avoid BIOS/UEFI issues. @@ -831,23 +831,29 @@ $ dd if=shredos-20200412.img of=/dev/sdx (20200412 will be the day you compiled, Do note that loading a configuration should typically be the last step before `make`. -> **The hybrid ISOs unite most functionality of all other formats:** +> **The hybrid ISOs offer the most flexibility over the other formats:** > >- are BIOS and UEFI bootable >- can both be written to CD/DVD-ROM and USB flash drives ->- have a writeable partition (when written to a USB flash drive) ->- **but** do not allow customization of GRUB (for `autonuke`, ...) +>- use ISOLINUX in BIOS for better compliance with very old systems +>- **but** do not have a writeable partition for PDFs/configurations +> +> Some tools such as Rufus offer an "ISO-Mode", which enable such a writeable +> partition (at burn-time). But this is not something that can be added to the +> ISO on the distribution side (at build-time), as it would break the hybrid +> functionality and standards that are needed for burning the ISO to CD/DVD-ROM. > >The **legacy** ISOs work in BIOS and UEFI, but only burned to CD/DVD-ROM. #### Building multiple configurations: Generally, when building multiple configurations of the above on the same -architecture, you only need to ensure that `make` and `make grub2-reconfigure` -are run between any two configurations. The same applies to any other package -whose configuration has changed, adding corresponding `-reconfigure` -steps. A `make clean` step is not usually required unless you have made -significant changes to the project, which should save time with such builds. +architecture, you only need to ensure that `make grub2-reconfigure` (and +eventually `make`) are run between any two configurations. The same applies to +any other package whose configuration has changed, adding corresponding +`-reconfigure` steps, before the eventual `make`. A `make clean` step is +not usually required unless you have made significant changes to the project, +which should save time for such builds between same-architecture configurations. For two configurations targeting different architectures, a full `make clean` is always required when switching between them, plan time for this (takes long). @@ -896,10 +902,6 @@ make_img_file.sh is a bash script, the main purpose of which is to generate the #### ../board/shredos/make_iso_file.sh make_iso_file.sh is a bash script, the main purpose of which is to generate the .iso file located in output/images/. The contents of board/shredos/version.txt is used to rename the .iso file with version info and the current date and time. -#### ../board/shredos/populate_efi_partition.sh -populate_efi_partition.sh is a bash script that copies the ShredOS files -(similar ones as `make_img_file.sh`) to the UEFI partition of the ISO image. - #### ../board/shredos/grub.cfg The USB image's GRUB configuration, which both the BIOS and UEFI bootloader will use. It contains the BIOS and UEFI boot menu for the USB image. @@ -919,7 +921,7 @@ It contains the UEFI boot menu for the ISO image. #### ../board/shredos/iso/efigrub.cfg The GRUB configuration that is embedded into the ISO's UEFI partition. -It contains directions for GRUB to find the ISO9660 FS and GRUB configuration. +It contains directions for GRUB to find the ISO9660's GRUB configuration. #### ../board/shredos/fsoverlay/etc/shredos/version.txt This file contains the version information as seen in the title on nwipe's title bar, i.e. '2021.08.2_22_x86-64_0.32.023'. This version ingformation is also used when naming the .img file in ../output/images/ ../board/shredos/fsoverlay/etc/shredos/version.txt is manually updated for each new release of ShredOS. diff --git a/board/shredos/README-ISO.txt b/board/shredos/README-ISO.txt deleted file mode 100644 index 23232b0f49..0000000000 --- a/board/shredos/README-ISO.txt +++ /dev/null @@ -1,5 +0,0 @@ -Do not modify the grub.cfg file in this folder trying to customize ShredOS -behavior. The ISO file does not support such customizations, and you should use -the IMG release instead (where you can modify the actual GRUB configuration) - -Get it from: https://github.com/PartialVolume/shredos.x86_64 diff --git a/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh b/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh index bd219beb08..3aded1ce8a 100755 --- a/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh +++ b/board/shredos/fsoverlay/usr/bin/find_shredos_boot_disc.sh @@ -3,7 +3,7 @@ # This program looks for any exfat, fat32 or fat16 filesystem, it then # examines the filesystem, looking for a kernel file or .img or .iso # file that has the same version number as the booted ShredOS. Once -# the boot USB has been found this script outputs the drive name in +# the boot USB has been found this script outputs the drive name in # the following form, example being /dev/sdc etc. # # If there is no FAT drive found the script fails silently @@ -46,23 +46,11 @@ fi # while read drive ; do - isEFI=$(fdisk -l | grep -i "$drive" | grep -i "EFI") - - # EFI partitions should not quality for "first drive" to avoid false - # positives; we only use it if confirmed as ours. The hybrid ISO image has - # an EFI partition that can be written to, and we need to ensure that other - # devices' EFI partitions remain untouched, disallowing EFI "first drive"s. - # - # Note that our USB image's FAT partition is not marked specifically as EFI - # (0xEF) but regular FAT (0xC/0x0C), so it still qualifies as "first drive". - if [[ "$first_drive" == "" ]] && [[ -z "$isEFI" ]] + if [[ "$first_drive" == "" ]] then first_drive=$drive fi - # We can use the EFI partition if it passes the below checks and is - # confirmed to be ours (of the hybrid ISO images, when flashed on USB). - if [[ "$drive" != "" ]] then mount $drive $drive_dir 2>&1 | tee -a transfer.log @@ -132,7 +120,7 @@ do umount $drive_dir 2>&1 | tee -a transfer.log fi -done <<< $(fdisk -l | grep -i "exfat\|fat16\|fat32\|EFI" | awk '{print $1}') +done <<< $(fdisk -l | grep -i "exfat\|fat16\|fat32" | awk '{print $1}') # If no boot disc has been found that contains the version of ShredOS # that is running, then output the first FAT formatted drive we came across. diff --git a/board/shredos/populate_efi_partition.sh b/board/shredos/populate_efi_partition.sh deleted file mode 100755 index 4163ba5043..0000000000 --- a/board/shredos/populate_efi_partition.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -e -# -# BR2_ROOTFS_POST_BUILD_SCRIPT for hybrid ISO configurations -# -# Our hybrid ISO has an accessible EFI partition, which we can (ab)use to store -# our information also, so we move the usual data onto it before creating the -# images. This should not cause any issues for CD/DVD-ROM burned ISO images, as -# the EFI partition will be in RAM, but allow any USB burned ISO images to have -# that writeable data location to put configuration files, logs and PDFs onto. -# -# Keep in mind that the EFI partition size (in configuration) must be below -# the maximum of 65535 blocks of 512 bytes (= ~32 MB) or the ISO may not -# be bootable on legacy systems, xorriso would warn about this during the -# ISO building stage (but not consider it a failure - just so you know...) -# - -mkdir -p "${BINARIES_DIR}/efi-part/boot/" || exit 1 - -cp "board/shredos/autorun.inf" "${BINARIES_DIR}/efi-part/autorun.inf" || exit 1 -cp "board/shredos/README.txt" "${BINARIES_DIR}/efi-part/README.txt" || exit 1 -cp "board/shredos/README-ISO.txt" "${BINARIES_DIR}/efi-part/EFI/BOOT/README.txt" || exit 1 -cp "board/shredos/shredos.ico" "${BINARIES_DIR}/efi-part/shredos.ico" || exit 1 -cp "board/shredos/fsoverlay/etc/shredos/version.txt" "${BINARIES_DIR}/efi-part/boot/version.txt" || exit 1 - -exit 0 diff --git a/configs/shredos_defconfig b/configs/shredos_defconfig index 9151237bf4..a5a41bdd9c 100644 --- a/configs/shredos_defconfig +++ b/configs/shredos_defconfig @@ -15,7 +15,6 @@ BR2_GENERATE_LOCALE="en_US.UTF-8" BR2_SYSTEM_ENABLE_NLS=y BR2_TARGET_TZ_INFO=y BR2_ROOTFS_OVERLAY="board/shredos/fsoverlay" -BR2_ROOTFS_POST_BUILD_SCRIPT="board/shredos/populate_efi_partition.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/shredos/make_iso_file.sh board/shredos/make_img_file.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y @@ -172,7 +171,6 @@ BR2_TARGET_ROOTFS_ISO9660_ISOLINUX_BOOT_MENU="board/shredos/iso/isolinux.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_BOOT_MENU="board/shredos/iso/grub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU="board/shredos/iso/efigrub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE="/boot/shredos.id" -BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_PARTITION_SIZE="28M" BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y diff --git a/configs/shredos_i586_defconfig b/configs/shredos_i586_defconfig index bc347cb06d..0d478560a9 100644 --- a/configs/shredos_i586_defconfig +++ b/configs/shredos_i586_defconfig @@ -13,7 +13,6 @@ BR2_GENERATE_LOCALE="en_US.UTF-8" BR2_SYSTEM_ENABLE_NLS=y BR2_TARGET_TZ_INFO=y BR2_ROOTFS_OVERLAY="board/shredos/fsoverlay" -BR2_ROOTFS_POST_BUILD_SCRIPT="board/shredos/populate_efi_partition.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/shredos/make_iso_file.sh board/shredos/make_img_file.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y @@ -169,7 +168,6 @@ BR2_TARGET_ROOTFS_ISO9660_ISOLINUX_BOOT_MENU="board/shredos/iso/isolinux.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_BOOT_MENU="board/shredos/iso/grub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU="board/shredos/iso/efigrub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE="/boot/shredos.id" -BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_PARTITION_SIZE="28M" BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y diff --git a/configs/shredos_iso_defconfig b/configs/shredos_iso_defconfig index 413374b354..a7869850c1 100644 --- a/configs/shredos_iso_defconfig +++ b/configs/shredos_iso_defconfig @@ -15,7 +15,6 @@ BR2_GENERATE_LOCALE="en_US.UTF-8" BR2_SYSTEM_ENABLE_NLS=y BR2_TARGET_TZ_INFO=y BR2_ROOTFS_OVERLAY="board/shredos/fsoverlay" -BR2_ROOTFS_POST_BUILD_SCRIPT="board/shredos/populate_efi_partition.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/shredos/make_iso_file.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y @@ -172,7 +171,6 @@ BR2_TARGET_ROOTFS_ISO9660_ISOLINUX_BOOT_MENU="board/shredos/iso/isolinux.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_BOOT_MENU="board/shredos/iso/grub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU="board/shredos/iso/efigrub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE="/boot/shredos.id" -BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_PARTITION_SIZE="28M" BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y diff --git a/configs/shredos_iso_i586_defconfig b/configs/shredos_iso_i586_defconfig index aceb560f25..39793bcc14 100644 --- a/configs/shredos_iso_i586_defconfig +++ b/configs/shredos_iso_i586_defconfig @@ -13,7 +13,6 @@ BR2_GENERATE_LOCALE="en_US.UTF-8" BR2_SYSTEM_ENABLE_NLS=y BR2_TARGET_TZ_INFO=y BR2_ROOTFS_OVERLAY="board/shredos/fsoverlay" -BR2_ROOTFS_POST_BUILD_SCRIPT="board/shredos/populate_efi_partition.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/shredos/make_iso_file.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y @@ -169,7 +168,6 @@ BR2_TARGET_ROOTFS_ISO9660_ISOLINUX_BOOT_MENU="board/shredos/iso/isolinux.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_BOOT_MENU="board/shredos/iso/grub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU="board/shredos/iso/efigrub.cfg" BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE="/boot/shredos.id" -BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_PARTITION_SIZE="28M" BR2_TARGET_ROOTFS_ISO9660_HYBRID=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_GRUB2=y diff --git a/fs/iso9660/Config.in b/fs/iso9660/Config.in index 690586de60..5f30f5c9a2 100644 --- a/fs/iso9660/Config.in +++ b/fs/iso9660/Config.in @@ -35,13 +35,13 @@ config BR2_TARGET_ROOTFS_ISO9660_GRUB2 help Use Grub 2 as the bootloader for the ISO9660 image. Make sure to enable the 'iso9660' module in - BR2_TARGET_GRUB2_BUILTIN_MODULES_PC and/or + (when used) BR2_TARGET_GRUB2_BUILTIN_MODULES_PC and (when used) BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI. For GRUB on BIOS, use 'cd' as the boot partition in BR2_TARGET_GRUB2_BOOT_PARTITION setting. For GRUB on EFI 'set root=(cd0)' in the configuration file passed - to BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU, although the - default configuration file contains a "search" directive using - BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE, which works too. + to BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI, although just an ISO9660 + BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU containing a "search" + using the BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE also works. config BR2_TARGET_ROOTFS_ISO9660_ISOLINUX bool "isolinux" @@ -117,6 +117,10 @@ config BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_BOOT_MENU baking an EFI search config into the common GRUB image (often better) check out instead the GRUB2 setting: BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI + Note that the strings __KERNEL_PATH__ and __INITRD_PATH__ + will automatically be replaced by the path to the kernel and + initrd images respectively (or removed, if not applicable). + Note that any string __EFI_ID_FILE__ will automatically be replaced with the BR2_TARGET_ROOTFS_ISO9660_GRUB2_EFI_IDENT_FILE.