From f4806bf7fa5c3d74f57953030a2d89f601affd4f Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 15 Apr 2026 09:22:23 +0200 Subject: [PATCH] fix(ci): Fix eMMC image check and RPi multi-initrd copy - build-all-live-usb.yml: Check for .img.gz first since build-image.sh already compresses and removes the .img file - build-rpi-usb.sh: Handle multiple kernel/initrd files by selecting the latest version instead of globbing which breaks cp Co-Authored-By: Claude Opus 4.5 --- .github/workflows/build-all-live-usb.yml | 16 +++++++++++++--- image/build-rpi-usb.sh | 15 +++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-all-live-usb.yml b/.github/workflows/build-all-live-usb.yml index 12815ee5..d8cefdd8 100644 --- a/.github/workflows/build-all-live-usb.yml +++ b/.github/workflows/build-all-live-usb.yml @@ -134,9 +134,19 @@ jobs: --suite ${{ env.DEBIAN_SUITE }} \ --out output/ \ --slipstream - echo "=== Compressing for embedding ===" - gzip -k output/secubox-espressobin-v7-bookworm.img - ls -lh output/secubox-espressobin-v7-bookworm.img.gz + echo "=== Checking eMMC image for embedding ===" + # build-image.sh already compresses to .img.gz, just verify it exists + if [[ -f output/secubox-espressobin-v7-bookworm.img.gz ]]; then + ls -lh output/secubox-espressobin-v7-bookworm.img.gz + elif [[ -f output/secubox-espressobin-v7-bookworm.img ]]; then + echo "Compressing uncompressed image..." + gzip -k output/secubox-espressobin-v7-bookworm.img + ls -lh output/secubox-espressobin-v7-bookworm.img.gz + else + echo "ERROR: No eMMC image found!" + ls -la output/ + exit 1 + fi timeout-minutes: 60 - name: Build ${{ matrix.platform }} Live USB diff --git a/image/build-rpi-usb.sh b/image/build-rpi-usb.sh index ef49788d..16a105dd 100755 --- a/image/build-rpi-usb.sh +++ b/image/build-rpi-usb.sh @@ -936,20 +936,23 @@ if ls "${MNT}/usr/lib/linux-image-"*/broadcom/*.dtb >/dev/null 2>&1; then fi # Copy kernel and initrd to boot partition -if ls "${MNT}/boot/vmlinuz-"* >/dev/null 2>&1; then - cp "${MNT}/boot/vmlinuz-"* "${MNT}/boot/firmware/vmlinuz" - ok "Kernel copied" +# Use ls | sort -V | tail -1 to get the latest version if multiple exist +VMLINUZ=$(ls "${MNT}/boot/vmlinuz-"* 2>/dev/null | sort -V | tail -1) +if [[ -n "$VMLINUZ" ]] && [[ -f "$VMLINUZ" ]]; then + cp "$VMLINUZ" "${MNT}/boot/firmware/vmlinuz" + ok "Kernel copied: $(basename $VMLINUZ)" else err "No kernel found in rootfs" fi -if ls "${MNT}/boot/initrd.img-"* >/dev/null 2>&1; then - cp "${MNT}/boot/initrd.img-"* "${MNT}/boot/firmware/initrd.img" +INITRD=$(ls "${MNT}/boot/initrd.img-"* 2>/dev/null | sort -V | tail -1) +if [[ -n "$INITRD" ]] && [[ -f "$INITRD" ]]; then + cp "$INITRD" "${MNT}/boot/firmware/initrd.img" # Add initramfs line to config.txt since we have an initrd if ! grep -q "^initramfs" "${MNT}/boot/firmware/config.txt"; then sed -i '/^kernel=vmlinuz/a initramfs initrd.img followkernel' "${MNT}/boot/firmware/config.txt" fi - ok "Initrd copied and config.txt updated" + ok "Initrd copied: $(basename $INITRD)" else log "No initrd - Pi will boot directly (this is OK)" # Ensure no initramfs line in config.txt