Skip to contentSkip to conversation

copy-firmware: Fix incorrect symlinks to uncompressed targets

PATCH In review Takashi Iwai 2 participants 2 messages Sep 13, 2024 – Oct 2, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 copy-firmware: Fix incorrect symlinks to uncompressed targets

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.

---

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(-)
copy-firmware.sh +7 -1
index 6757c6ce03a3..fc096dd6daf0 100755
@@ -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
Signature · 1 line
2.43.0
#1 lore raw
Quoted 7 lines · Takashi Iwai

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.

Quoted 8 lines

---

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.

Juerg came up with something slightly different:
https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/297

josh

Quoted 29 lines

 copy-firmware.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
copy-firmware.sh +7 -2
index 6757c6ce03a3..fc096dd6daf0 100755
@@ -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