[PATCH linux-firmware] copy-firmware: Fix incorrect symlinks to uncompressed targets

From: Takashi Iwai
Date: Fri Sep 13 2024 - 05:20:48 EST


The script tries to make a symlink to the target with the compressed
extension, but it ends up with a wrong symlink if the compression is
skipped for the target (e.g. via RawFile entry).

Add more checks to make a correct symlink.

Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---

This fixes the installation failure with the recent change for qcom
commit 541f96c0fa47b70e9bc13035f7a082064e5b2d4c

The workaround is pretty ad hoc, so if you have a better way to manage
it, feel free to scratch this.


copy-firmware.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/copy-firmware.sh b/copy-firmware.sh
index 6757c6ce03a3..fc096dd6daf0 100755
--- a/copy-firmware.sh
+++ b/copy-firmware.sh
@@ -136,9 +136,15 @@ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
if test -d "$target"; then
$verbose "creating link $f -> $d"
ln -s "$d" "$destdir/$f"
- else
+ elif test -f "$target$compext"; then
$verbose "creating link $f$compext -> $d$compext"
ln -s "$d$compext" "$destdir/$f$compext"
+ elif test -f "$target"; then
+ $verbose "creating link $f -> $d"
+ ln -s "$d" "$destdir/$f"
+ else
+ $verbose "creating link (not yet existing) $f$compext -> $d$compext"
+ ln -s "$d$compext" "$destdir/$f$compext"
fi
fi
done
--
2.43.0