From d8a917020ffd079d25a00796953085d4da9e6469 Mon Sep 17 00:00:00 2001 From: Leonardo Fagundes Luz Serrano Date: Wed, 29 May 2024 14:13:46 -0300 Subject: [PATCH] Updated prepatched ISO generation command patch-iso-debian script uses the mkisofs command to generate an ISO. Some flags are used there to define the El Torito configs, but one of these flags needs to be updated in order to work in the LAT container. Changes: - Replaced the '-e' flag for '-eltorito-boot' - Added '-eltorito-platform 0xEF' flag, following [1] - Removed "-quiet" flag - Added support for mkisofs backup option: xorrisofs Note: The mkisofs command available in the LAT container has been customized in order to properly support El Torito configs [2]. In order to execute patch-iso-debian outside the LAT container, the developer can use cmds from the xorriso package: either "xorrisofs" or "xorriso -as mkisofs" [3] Ref: [1] https://github.com/yoctoproject/poky/blob/master/scripts/lib/wic/plugins/source/isoimage-isohybrid.py#L424 [2] https://github.com/openembedded/meta-openembedded/commit/19c6b9a32432e56ac03373193eb2e4b44a33547c [3] https://wiki.debian.org/RepackBootableISO Test Plan: Generate and install pre-patched ISO produced pass - Script ran inside LAT pass - Script ran outside LAT Story: 2011098 Task: 50217 Depends-On: https://review.opendev.org/c/starlingx/root/+/923771 Change-Id: I9c6b15b16385d3e2b4d385378211113d02438c23 Signed-off-by: Leonardo Fagundes Luz Serrano --- build-tools/patch-iso-debian | 47 +++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/build-tools/patch-iso-debian b/build-tools/patch-iso-debian index c524abd6..42cb8193 100755 --- a/build-tools/patch-iso-debian +++ b/build-tools/patch-iso-debian @@ -136,12 +136,12 @@ function check_requirements { # Declare "require reqA or reqB" as "reqA__reqB" local -a required_utils=( - 7z # p7zip-full - mkisofs # genisoimage - isohybrid # syslinux-utils - implantisomd5 # isomd5sum - ostree # ostree - xmllint__python3 # libxml2-utils + 7z # p7zip-full + mkisofs__xorrisofs # genisoimage / xorriso + isohybrid # syslinux-utils + implantisomd5 # isomd5sum + ostree # ostree + xmllint__python3 # libxml2-utils / python3 ) local -i missing=0 @@ -265,26 +265,39 @@ fi echo "ISO Label: ${ISO_LABEL}" function pack_iso(){ - # Repack the ISO - mkisofs -o "${OUTPUT_ISO}" \ - -A "${ISO_LABEL}" -V "${ISO_LABEL}" \ - -quiet -U -J -joliet-long -r -iso-level 2 \ - -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ - -boot-load-size 4 -boot-info-table \ - -eltorito-alt-boot \ - -e efi.img \ - -no-emul-boot \ - "${BUILDDIR}" + if (which xorrisofs &>/dev/null); then + PACK_ISO_CMD="xorrisofs" + else + PACK_ISO_CMD="mkisofs" + fi + echo "ISO packaging command: ${PACK_ISO_CMD}" + + # Command Reference: + # https://github.com/yoctoproject/poky/blob/master/scripts/lib/wic/plugins/source/isoimage-isohybrid.py#L419 + + ${PACK_ISO_CMD} \ + -V "${ISO_LABEL}" \ + -o "${OUTPUT_ISO}" -U \ + -J -joliet-long -r -iso-level 2 -b "isolinux/isolinux.bin" \ + -c "isolinux/boot.cat" -no-emul-boot -boot-load-size 4 \ + -boot-info-table -eltorito-alt-boot \ + -eltorito-platform "0xEF" -eltorito-boot "efi.img" \ + -no-emul-boot "${BUILDDIR}" isohybrid --uefi "${OUTPUT_ISO}" implantisomd5 "${OUTPUT_ISO}" } if ! pack_iso; then + if [ "${PACK_ISO_CMD}" = "mkisofs" ]; then + echo "NOTE: mkisofs has a customization in the LAT container to provide the '-eltorito-boot' flag." + echo " To execute this script outside the LAT container, install the 'xorriso' package and run again." + fi + echo "ERROR: Failed to build output ISO!" exit 1 fi -echo "Signing the .iso with the developer private key.." +echo "Signing the .iso with the developer private key..." function sign_iso(){ openssl dgst -sha256 \