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 <noreply@anthropic.com>
This commit is contained in:
CyberMind-FR 2026-04-15 09:22:23 +02:00
parent 0f970bb8de
commit f4806bf7fa
2 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -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