]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make lsinitrd usable for images made with Debian mkinitramfs
authorTopi Miettinen <toiwoton@gmail.com>
Sun, 1 Mar 2020 10:22:30 +0000 (12:22 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Tue, 3 Mar 2020 11:48:58 +0000 (12:48 +0100)
Debian mkinitramfs does not create the file 'early_cpio', so detection
of additional cpio images fails and only the first cpio is listed.

I checked some Arch and Gentoo initramfs files and these didn't have
'early_cpio' either, but they also have only one cpio part.

Fix this so that if check for 'early_cpio' fails, check if firmware
files ('/kernel/*/microcode/*.bin') exist.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
lsinitrd.sh

index 67af769e0f63dd791fb8ae7754358bd38e4c891c..b5c73f62f228b58bc2a51697fcebdb8a5669a09c 100755 (executable)
@@ -236,6 +236,8 @@ case $bin in
     $'\x71\xc7'*|070701)
         CAT="cat --"
         is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
+        # Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
+        [[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2>/dev/null)
         if [[ "$is_early" ]]; then
             if [[ -n "$unpack" ]]; then
                 # should use --unpackearly for early CPIO