fix(shredos): refactor post-process scripts

Post-processing used a static (outdated?) GRUB image for USB image generation, but it is better to use the GRUB image produced as part of the building process, which ensures that the actual compiled GRUB version is used as bootloader in our images and not an outdated one.

Post-processing previously embedded the 64-bit EFI bootloader to 32-bit builds, as no architecture checks were in place. This was changed to check for architecture and embed the correct EFI bootloader for the respective target architecture instead.

The GRUB configuration was changed to use a menu, to allow the user to choose between standard and nomodeset parameters, while also allowing the user to edit the command line to append other kernel parameters they may need for their systems.

The vanity kernel image name was returned to bzImage to clearly mark the image for what it is, and to remain consistent with the ISO file generation where we have no direct control over the image now.

Signed-off-by: desertwitch <24509509+desertwitch@users.noreply.github.com>
This commit is contained in:
desertwitch
2025-11-18 07:32:51 +01:00
parent 56333565cb
commit af1654ee9f
7 changed files with 130 additions and 37 deletions

50
board/shredos/make_img_file.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/bin/bash -e
if grep -Eq "^BR2_ARCH_IS_64=y$" "${BR2_CONFIG}"; then
MKIMAGE_ARCH=x86_64
MKIMAGE_EFI=bootx64.efi
MKIMAGE_CFG=genimage.cfg
else
MKIMAGE_ARCH=i586
MKIMAGE_EFI=bootia32.efi
MKIMAGE_CFG=genimage_i586.cfg
fi
version=$(cat board/shredos/fsoverlay/etc/shredos/version.txt)
cp "board/shredos/grub.cfg" "${BINARIES_DIR}/grub.cfg" || exit 1
cp "output/target/lib/grub/i386-pc/boot.img" "${BINARIES_DIR}/boot.img" || exit 1
cp "${BINARIES_DIR}/efi-part/EFI/BOOT/${MKIMAGE_EFI}" "${BINARIES_DIR}/${MKIMAGE_EFI}" || exit 1
cp "board/shredos/autorun.inf" "${BINARIES_DIR}/autorun.inf" || exit 1
cp "board/shredos/README.txt" "${BINARIES_DIR}/README.txt" || exit 1
cp "board/shredos/shredos.ico" "${BINARIES_DIR}/shredos.ico" || exit 1
# version.txt is used to help identify the (boot) USB disk
cp "board/shredos/fsoverlay/etc/shredos/version.txt" "${BINARIES_DIR}/version.txt" || exit 1
rm -rf "${BUILD_DIR}/genimage.tmp" || exit 1
genimage --rootpath="${TARGET_DIR}" \
--inputpath="${BINARIES_DIR}" \
--outputpath="${BINARIES_DIR}" \
--config="board/shredos/${MKIMAGE_CFG}" \
--tmppath="${BUILD_DIR}/genimage.tmp" || exit 1
SUFFIXIMG="${version}_$(date +%Y%m%d)"
FINAL_IMAGE_PATH="${BINARIES_DIR}/shredos-${SUFFIXIMG}.img"
mv "${BINARIES_DIR}/shredos.img" "${FINAL_IMAGE_PATH}" || exit 1
GREEN="\033[0;32m"
RESET="\033[0m"
printf "%b" "$GREEN"
echo
echo "==============================================="
echo " USB image '${FINAL_IMAGE_PATH}'"
echo " (for '${MKIMAGE_ARCH}' architecture)"
echo " CREATED SUCCESSFULLY!"
echo "==============================================="
echo
printf "%b\n" "$RESET"
exit 0