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

Takashi Iwai posted 1 patch 2 months, 2 weeks ago
copy-firmware.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[PATCH linux-firmware] copy-firmware: Fix incorrect symlinks to uncompressed targets
Posted by Takashi Iwai 2 months, 2 weeks ago
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@suse.de>
---

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
Re: [PATCH linux-firmware] copy-firmware: Fix incorrect symlinks to uncompressed targets
Posted by Josh Boyer 1 month, 4 weeks ago
On Fri, Sep 13, 2024 at 5:20 AM Takashi Iwai <tiwai@suse.de> wrote:
>
> 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@suse.de>
> ---
>
> 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

>
>
>  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
>