<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 23 August 2018 at 07:39, Martin Hundebøll <span dir="ltr"><<a href="mailto:martin@geanix.com" target="_blank">martin@geanix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">May I suggest using the '-r, --relative' flag from 'ln':<br>
<br>
-r, --relative<br>
create symbolic links relative to link location<br>
<br>
My life felt considerably better after discovering that feature :)<br></blockquote><div><br></div><div>Thanks Martin <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Hundebøll</span>! Yes, that works for me.</div><div><br></div><div>So, Martin Jansa, I could make this change:</div><div><br></div><div><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">- ( cd ${D}${nonarch_base_libdir}/</span><wbr style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">firmware/brcm/ ; ln -sf brcmfmac43430-sdio.MUR1DX.txt brcmfmac43430-sdio.txt)</span></div><div><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">+ ( </span><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">ln -sfr <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">${D}${nonarch_base_libdir}/</span><wbr style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">firmware/brcm/</span>brcmfmac43430-sdio.MUR1DX.txt <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">${D}${nonarch_base_libdir}/</span><wbr style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">firmware/brcm/</span>brcmfmac43430-sdio.txt)</span><br style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Of course, if I'm not going to "cd" into the firmware repo, I'll have to use absolute paths on both sides of the "ln" command anyway. So I could drop the 'r' param and it should still work. Eg:</span></div><div><span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">- ( cd ${D}${nonarch_base_libdir}/</span><wbr style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">firmware/brcm/ ; ln -sf brcmfmac43430-sdio.MUR1DX.txt brcmfmac43430-sdio.txt)</span></div><div style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">+ (<span> </span></span><span style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">ln -sf <span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">${D}${nonarch_base_libdir}/</span><wbr style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">firmware/brcm/</span>brcmfmac43430-sdio.MUR1DX.txt<span> </span><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">${D}${nonarch_base_libdir}/</span><wbr style="text-decoration-style:initial;text-decoration-color:initial"><span style="text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">firmware/brcm/</span>brcmfmac43430-sdio.txt)</span><br style="color:rgb(80,0,80);font-size:11.2px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"></div></div><div><br></div><div>I'm still not sure this is any neater, though, as it involves using the path twice. Is there a maintainer here who has a preference?</div><div><br></div><div>FWIW, the TI line that I copied was added by Koen Kooi, who I've added to the CC:</div><div><br></div><div><div>8c7adb6 2011-10-09 linux-firmware: update, merge in OE classic updates, fix p.. [Koen Kooi]</div></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
// Martin<br>
<br>
On 23/08/2018 08.12, Ryan Harkin wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">
<br>
<br>
On 22 August 2018 at 23:55, Andre McCurdy <<a href="mailto:armccurdy@gmail.com" target="_blank">armccurdy@gmail.com</a> <mailto:<a href="mailto:armccurdy@gmail.com" target="_blank">armccurdy@gmail.com</a>>> wrote:<br>
<br>
On Wed, Aug 22, 2018 at 2:56 PM, Ryan Harkin <<a href="mailto:ryan.harkin@linaro.org" target="_blank">ryan.harkin@linaro.org</a><br></span><span class="gmail-">
<mailto:<a href="mailto:ryan.harkin@linaro.org" target="_blank">ryan.harkin@linaro.org</a><wbr>>> wrote:<br>
> On Wed, 22 Aug 2018, 21:42 Andre McCurdy, <<a href="mailto:armccurdy@gmail.com" target="_blank">armccurdy@gmail.com</a><br></span><span class="gmail-">
<mailto:<a href="mailto:armccurdy@gmail.com" target="_blank">armccurdy@gmail.com</a>>> wrote:<br>
>> On Wed, Aug 22, 2018 at 1:10 PM, Ryan Harkin<br></span>
<<a href="mailto:ryan.harkin@linaro.org" target="_blank">ryan.harkin@linaro.org</a> <mailto:<a href="mailto:ryan.harkin@linaro.org" target="_blank">ryan.harkin@linaro.org</a><wbr>>><span class="gmail-"><br>
>> wrote:<br>
>> > On Wed, 22 Aug 2018, 20:02 Martin Jansa,<br></span><div><div class="gmail-h5">
<<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a> <mailto:<a href="mailto:martin.jansa@gmail.com" target="_blank">martin.jansa@gmail.com</a><wbr>>> wrote:<br>
>> >><br>
>> >> Your 1st parameter is wrong, compare again with the example I<br>
gave you<br>
>> >> (don't include "brcm/" path in 1st param, because you want<br>
the symlink<br>
>> >> to<br>
>> >> point to just brcmfmac43430-sdio.AP6212.txt like you did in<br>
the version<br>
>> >> after cd).<br>
>> ><br>
>> > That doesn't work either. I tried it with the same result, but<br>
didn't<br>
>> > send a<br>
>> > log of it. That works for you?<br>
>><br>
>> Martin's example is correct so maybe check your tests again for<br>
typos.<br>
>> It it still doesn't work then please do send a log.<br>
>><br>
>> The link will point to whatever you define via the first<br>
parameter, so<br>
>> if you changed the first parameter it shouldn't be possible to get<br>
>> "the same result".<br>
>><br>
>> $ mkdir foo<br>
>> $ ln -sf test_target foo/test1<br>
>> $ ln -sf brcm/test_target foo/test2<br>
>> $ ls -l foo<br>
>><br>
>> lrwxrwxrwx 1 andre andre 11 Aug 22 13:35 test1 -> test_target<br>
>> lrwxrwxrwx 1 andre andre 16 Aug 22 13:35 test2 -> brcm/test_target<br>
><br>
> Yes, that's essentially the same as what I'm getting.<br>
><br>
> Now try "cat foo/test1" and what happens?<br>
><br>
> There is no file called test_target in the foo directory. And<br>
neither is<br>
> there a file called brcm/test_target in the foo directory.<br>
<br>
Correct. The above was just an example to show that you can * create<br>
symlinks * in the foo directory without cd'ing into the foo directory<br>
first.<br>
<br>
If you'd like the symlinks in the example to point to valid targets<br>
then you need to create the targets too, e.g.<br>
<br>
$ mkdir -p foo/brcm<br>
$ echo hello > foo/test_target<br>
$ echo hello2 > foo/brcm/test_target<br>
<br>
But note that the process of creating a symlink is always the same,<br>
regardless of whether the symlink points to a valid target or not (so<br>
you can run these extra commands to create the targets before or after<br>
you create the symlinks).<br>
<br>
<br>
So that doesn't work for me how I expect it to work. I must be missing something fundamental here.<br>
<br>
The recipe is trying to create a soft link from a file in the current directory to a file in the sub-directory. On my system, your example creates links from a file in the sub-directory to the another file in the sub-directory.<br>
<br>
So, to copy your example, but creating the file "test_target" from the start:<br>
<br>
$ mkdir -p /tmp/test<br>
$ cd /tmp/test<br>
$ mkdir foo<br>
$ echo 1 > test_target<br>
$ ln -sf test_target foo/test1<br>
$ ln -sf brcm/test_target foo/test2<br>
$ ls -l foo<br>
total 0<br>
lrwxrwxrwx 1 ryan ryan 11 Aug 23 06:54 test1 -> test_target<br>
lrwxrwxrwx 1 ryan ryan 16 Aug 23 06:54 test2 -> brcm/test_target<br>
$ cat test_target<br>
1<br>
$ cat foo/test1<br>
cat: foo/test1: No such file or directory<br>
$ cat foo/test2<br>
cat: foo/test2: No such file or directory<br>
$ echo hello > foo/test_target<br>
$ echo hello2 > foo/brcm/test_target<br>
bash: foo/brcm/test_target: No such file or directory<br>
$ cat foo/test1<br>
hello<br>
$ cat foo/test2<br>
cat: foo/test2: No such file or directory<br>
$ cat test_target<br>
1<br>
$ tree<br>
.<br>
├── foo<br>
│ ├── test1 -> test_target<br>
│ ├── test2 -> brcm/test_target<br>
│ └── test_target<br>
└── test_target<br>
<br>
1 directory, 4 files<br>
<br>
So, neither test1 nor test2 are linked to /tmp/test/test_target. test1 is linked to /tmp/test/foo/test_target and test2 is linked to /tmp/test/brcm/test_target, which doesn't exist.<br>
<br>
AFAIK, when creating a softlink, you have to give it either an absolute path, or a path relative to the link being created. The path cannot be relative to the original file that you want to link to.<br>
<br>
So, this will work:<br>
<br>
$cd /tmp/test<br>
$ ln -sf ../test_target foo/test3<br>
$ cat foo/test3<br>
1<br>
$ cat /tmp/test/foo/test3<br>
1<br>
<br>
But that is a strange way to create the soft link, IMO.<br>
<br>
AFAICT, for the recipe, to get rid of the "cd", I'd have to specify an absolute path to the original file:<br>
<br>
+do_install_append_bcm43430-nv<wbr>ram-mur1dx() {<br>
+ ( ln -sf ${PWD}/brcmfmac43430-sdio.MUR1<wbr>DX.txt ${D}${nonarch_base_libdir}/fir<wbr>mware/brcm/brcmfmac43430-sdio.<wbr>txt)<br>
<br>
... assuming PWD is available to the recipe. There will be a proper Yocto variable I can use, of course, but I can't think of it right now.<br>
<br>
Either way, Martin's example doesn't work for me. And adding the absolute path of the original file doesn't seem any neater or clearer than following the TI example from the do_install a few lines up in the recipe. But I'm happy to do it either way, so long as it works.<br>
<br>
</div></div></blockquote><span class="gmail-HOEnZb"><font color="#888888">
<br>
-- <br>
Kind regards,<br>
Martin Hundebøll<br>
Embedded Linux Consultant<br>
<br>
+45 61 65 54 61<br>
<a href="mailto:martin@geanix.com" target="_blank">martin@geanix.com</a><br>
<br>
Geanix IVS<br>
<a href="https://geanix.com" rel="noreferrer" target="_blank">https://geanix.com</a><br>
DK39600706<br>
</font></span></blockquote></div><br></div></div>