summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-11-17 15:18:32 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2022-11-17 15:50:38 +0000
commit78d231f9ca462dd3147ecb08b49e6740dc171d5b (patch)
tree488a557fa62917bcbe8997e855191352e0737b9a
parent121330d625fd7f9d537c72c40bf50a61c7a0ac51 (diff)
downloadalpine-conf-78d231f9ca462dd3147ecb08b49e6740dc171d5b.zip
update-kernel: fix firmware inclusion in modloop
Some brcm firmwares uses a glob. Fix this and add tests to verify that it works as expected. fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10533
-rwxr-xr-xtests/bin/apk3
-rwxr-xr-xtests/update_kernel_test2
-rw-r--r--update-kernel.in11
3 files changed, 11 insertions, 5 deletions
diff --git a/tests/bin/apk b/tests/bin/apk
index 6ad3bc2..5ac1a76 100755
--- a/tests/bin/apk
+++ b/tests/bin/apk
@@ -38,7 +38,8 @@ for pkg in $pkgs; do
touch "$rootfs"/lib/firmware/brcm/brcmfmac43456-sdio.raspberrypi,400.bin \
"$rootfs"/lib/firmware/brcm/brcmfmac43456-sdio.raspberrypi,400.clm_blob \
"$rootfs"/lib/firmware/brcm/brcmfmac43456-sdio.raspberrypi,400.txt \
- "$rootfs"/lib/firmware/brcm/brcmfmac43752-sdio.bin
+ "$rootfs"/lib/firmware/brcm/brcmfmac43752-sdio.bin \
+ "$rootfs"/lib/firmware/brcm/brcmfmac43752-sdio.txt
;;
linux-*)
# simulate installing kernel
diff --git a/tests/update_kernel_test b/tests/update_kernel_test
index 99d55ba..08ccf2c 100755
--- a/tests/update_kernel_test
+++ b/tests/update_kernel_test
@@ -44,5 +44,7 @@ update_kernel_firmware_body() {
-o match:"apk add.*linux-firmware" \
-o match:"file .*brcmfmac.ko" \
-o match:"file .*brcm/brcmfmac43752-sdio.bin" \
+ -o match:"file .*brcm/brcmfmac43752-sdio.txt" \
+ -o match:"file .*brcmfmac.*sdio.raspberrypi*" \
update-kernel --verbose --flavor rpi out/
}
diff --git a/update-kernel.in b/update-kernel.in
index dd764a0..a6fecbb 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -296,13 +296,16 @@ mkdir $MODLOOP $STAGING
cp -a $ROOTFS/lib/modules $MODLOOP
mkdir -p $MODLOOP/modules/firmware
find $ROOTFS/lib/modules -type f -name "*.ko*" | xargs modinfo -k $KVER -F firmware | sort -u | while read FW; do
- if [ -e "$ROOTFS/lib/firmware/$FW" ]; then
- install -pD $ROOTFS/lib/firmware/$FW $MODLOOP/modules/firmware/$FW
+ for f in "$ROOTFS"/lib/firmware/$FW; do
+ if ! [ -e "$f" ]; then
+ continue
+ fi
+ install -pD "$f" $MODLOOP/modules/firmware/${f#*/lib/firmware}
# copy also all potentially associated files
- for _file in "$ROOTFS"/lib/firmware/"${FW%.*}".*; do
+ for _file in "${f%.*}".*; do
install -pD "$_file" "$MODLOOP/modules/firmware/${_file#*/lib/firmware/}"
done
- fi
+ done
done
# install extra firmware files in modloop (i.e. not detected by modinfo)