Skip to contentSkip to conversation

Problem with create symlinks code in copy-firmware.sh

DISCUSSION Timur Tabi 2 participants 2 messages Nov 7, 2023 – Nov 8, 2023

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

Mario,

I think there's something wrong with the code you added to copy-firmware.sh that uses rdfind to create symlinks.

$verbose rdfind -makesymlinks true "$destdir" -outputname $rdfind_results "$quiet"

find "$destdir" -type l | while read -r l; do

        target="$(realpath "$l")"

        ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l"

done

I have a commit that I'm about to submit to linux-firmware:

https://github.com/NVIDIA/linux-firmware/commit/415a5650947396d462033fdf8aa8e6fdf0d9866d

When I run copy-firmware.sh on my tree, everything seems to be okay, until this code is run.

As an example, before your code is run, /lib/firmware/nvida/ad102/gsp looks like this:

# ls -l /lib/firmware/nvidia/ad102/gsp/

total 132

-rw-r--r-- 1 root root 55928 Nov 7 11:51 booter_load-535.113.01.bin

-rw-r--r-- 1 root root 39800 Nov 7 11:51 booter_unload-535.113.01.bin

-rw-r--r-- 1 root root 32876 Nov 7 11:51 bootloader-535.113.01.bin

lrwxrwxrwx 1 root root 34 Nov 7 11:51 gsp-535.113.01.bin -> ../../ga102/gsp/gsp-535.113.01.bin

But your code adds an extra bogus 'gsp' symlink:

-rw-r--r-- 1 root root 55928 Nov 7 11:49 booter_load-535.113.01.bin

-rw-r--r-- 1 root root 39800 Nov 7 11:49 booter_unload-535.113.01.bin

-rw-r--r-- 1 root root 32876 Nov 7 11:49 bootloader-535.113.01.bin

lrwxrwxrwx 1 root root 12 Nov 7 11:49 gsp -> ../ad102/gsp

lrwxrwxrwx 1 root root 34 Nov 7 11:49 gsp-535.113.01.bin -> ../../ga102/gsp/gsp-535.113.01.bin

Can you please take a look at this?

#1 lore raw

[Public]

Thanks!

I’ve submitted a fix for review here:
Fix symlink creation for some files (!54) · Merge requests · kernel-firmware / Linux Firmware · GitLab<https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/54>

From: Timur Tabi <[email protected]>
Sent: Tuesday, November 7, 2023 12:04
To: Limonciello, Mario <[email protected]>; [email protected]
Subject: Problem with create symlinks code in copy-firmware.sh

Mario,

I think there's something wrong with the code you added to copy-firmware.sh that uses rdfind to create symlinks.

$verbose rdfind -makesymlinks true "$destdir" -outputname $rdfind_results "$quiet"

find "$destdir" -type l | while read -r l; do

       target="$(realpath "$l")"

       ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l"

done

I have a commit that I'm about to submit to linux-firmware:

https://github.com/NVIDIA/linux-firmware/commit/415a5650947396d462033fdf8aa8e6fdf0d9866d

When I run copy-firmware.sh on my tree, everything seems to be okay, until this code is run.

As an example, before your code is run, /lib/firmware/nvida/ad102/gsp looks like this:

# ls -l /lib/firmware/nvidia/ad102/gsp/

total 132

-rw-r--r-- 1 root root 55928 Nov 7 11:51 booter_load-535.113.01.bin

-rw-r--r-- 1 root root 39800 Nov 7 11:51 booter_unload-535.113.01.bin

-rw-r--r-- 1 root root 32876 Nov 7 11:51 bootloader-535.113.01.bin

lrwxrwxrwx 1 root root 34 Nov 7 11:51 gsp-535.113.01.bin -> ../../ga102/gsp/gsp-535.113.01.bin

But your code adds an extra bogus 'gsp' symlink:

-rw-r--r-- 1 root root 55928 Nov 7 11:49 booter_load-535.113.01.bin

-rw-r--r-- 1 root root 39800 Nov 7 11:49 booter_unload-535.113.01.bin

-rw-r--r-- 1 root root 32876 Nov 7 11:49 bootloader-535.113.01.bin

lrwxrwxrwx 1 root root 12 Nov 7 11:49 gsp -> ../ad102/gsp

lrwxrwxrwx 1 root root 34 Nov 7 11:49 gsp-535.113.01.bin -> ../../ga102/gsp/gsp-535.113.01.bin

Can you please take a look at this?