mkmodpack: include leading directories for firmware files

The kernel needs leading directories in the cpio archive when
creating rootfs. Otherwise, the files will not be copied.
This commit is contained in:
Egor Ignatov 2021-07-21 18:22:16 +03:00
parent eee4e636d9
commit 7738617c4c
No known key found for this signature in database
GPG Key ID: DB21C97B6BDF202A

View File

@ -136,13 +136,12 @@ AddModuleFirmware()
Warning "Firmware file \"$fw_name\" for module \"$mod_name\" not found"
continue
}
[ "$fw_name" = "${fw_name##*/}" ] || {
[ -n "$fw_privdir" ] || {
fw_privdir="${fw_name%/*}"
fw_privdir=$fw_name
while [ ! "$fw_privdir" = "${fw_name%%/*}" ]; do
fw_privdir="${fw_privdir%/*}"
FILES="$FILES
dir /lib/firmware/$fw_privdir 0755 0 0"
}
}
done
FILES="$FILES
file /lib/firmware/$fw_name $fw_file 0644 0 0"
done
@ -223,7 +222,7 @@ depmod -a -F "/boot/System.map-$KERNEL" -b "$WORKDIR" "$KERNEL" || Fatal "Failed
cd "$WORKDIR"
find "lib/modules/$KERNEL" -type d |sed -e 's,^.\+$,dir\t/&\t0755\t0 0,g'
find "lib/modules/$KERNEL" -type f |sed -e "s,^.\+$,file\t/&\t$WORKDIR/&\t0644\t0 0,g"
echo "$FILES"
echo "$FILES"|sort -k2|uniq
) > "$TEMPLATE"
if [ -n "$OUTPUT" ]; then