From 0a8267f69b087b99d29b84193c8aa5c084030b45 Mon Sep 17 00:00:00 2001 From: Adrian Vladu Date: Wed, 18 Sep 2024 14:46:44 +0000 Subject: [PATCH] cpio: do not fail on ghost rootfs On Linux >= 6.10, the first rootfs is an extra ghost rootfs of 336K, that has a corrupted CPIO. To overcome this issue, do not fail on `cpio --extract`. --- build_library/extract-initramfs-from-vmlinuz.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build_library/extract-initramfs-from-vmlinuz.sh b/build_library/extract-initramfs-from-vmlinuz.sh index 9c1ffb6952..0ace26a610 100755 --- a/build_library/extract-initramfs-from-vmlinuz.sh +++ b/build_library/extract-initramfs-from-vmlinuz.sh @@ -81,11 +81,9 @@ perform_round() { for rnd in "${round_prefix}"*; do if [[ $(file --brief "${rnd}") =~ 'cpio archive' ]]; then mkdir -p "${out}/rootfs-${ROOTFS_IDX}" - while cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*'; do - ROOTFS_IDX=$(( ROOTFS_IDX + 1 )) - mkdir -p "${out}/rootfs-${ROOTFS_IDX}" - done <${rnd} - rmdir "${out}/rootfs-${ROOTFS_IDX}" + # On Linux 6.10, the first rootfs is an extra ghost rootfs of 336K, that has a corrupted CPIO + cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*' < $rnd || true + ROOTFS_IDX=$(( ROOTFS_IDX + 1 )) fi done }