<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 23 August 2018 at 08:34, Andre McCurdy <span dir="ltr"><<a href="mailto:armccurdy@gmail.com" target="_blank">armccurdy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Aug 23, 2018 at 12:17 AM, Ryan Harkin <<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>> wrote:<br>
> On 23 August 2018 at 08:06, Andre McCurdy <<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>> wrote:<br>
>> On Wed, Aug 22, 2018 at 11:12 PM, Ryan Harkin <<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>><br>
>> wrote:<br>
>> > On 22 August 2018 at 23:55, Andre McCurdy <<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>> wrote:<br>
>> >> On Wed, Aug 22, 2018 at 2:56 PM, Ryan Harkin <<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>><br>
>> >> wrote:<br>
>> >> > On Wed, 22 Aug 2018, 21:42 Andre McCurdy, <<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>><br>
>> >> > wrote:<br>
>> >> >> On Wed, Aug 22, 2018 at 1:10 PM, Ryan Harkin<br>
>> >> >> <<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>><br>
>> >> >> wrote:<br>
>> >> >> > On Wed, 22 Aug 2018, 20:02 Martin Jansa, <<a href="mailto:martin.jansa@gmail.com">martin.jansa@gmail.com</a>><br>
>> >> >> > wrote:<br>
>> >> >> >><br>
>> >> >> >> Your 1st parameter is wrong, compare again with the example I<br>
>> >> >> >> gave<br>
>> >> >> >> you<br>
>> >> >> >> (don't include "brcm/" path in 1st param, because you want the<br>
>> >> >> >> symlink<br>
>> >> >> >> to<br>
>> >> >> >> point to just brcmfmac43430-sdio.AP6212.txt like you did in the<br>
>> >> >> >> 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 parameter,<br>
>> >> >> 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 neither<br>
>> >> > 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>
>> > So that doesn't work for me how I expect it to work. I must be missing<br>
>> > something fundamental here.<br>
>> ><br>
>> > The recipe is trying to create a soft link from a file in the current<br>
>> > directory to a file in the sub-directory. On my system, your example<br>
>> > creates<br>
>> > links from a file in the sub-directory to the another file in the<br>
>> > sub-directory.<br>
>> ><br>
>> > So, to copy your example, but creating the file "test_target" from the<br>
>> > start:<br>
>> ><br>
>> > $ mkdir -p /tmp/test<br>
>> > $ cd /tmp/test<br>
>> > $ mkdir foo<br>
>> > $ echo 1 > test_target<br>
>><br>
>> Here you are creating "test_target" in the directory which contains<br>
>> foo, not inside foo. So a symlink inside foo pointing to "test_target"<br>
>> isn't going to work.<br>
><br>
> Exactly my point! Martin asked me to do this:<br>
><br>
>> ln -sf brcmfmac43430-sdio.AP6212.txt<br>
>> ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.txt<br>
><br>
> Which is in essence what I'm doing above. It won't work. The file<br>
> "brcmfmac43430-sdio.AP6212.<wbr>txt" doesn't exist in the current directory.<br>
> That's why there's a "cd" command in there.<br>
<br>
</div></div>I think you're really still quite confused about something here...<br>
<br>
You don't need to have any file existing in the current directory (or<br>
anywhere else) in order to create a symlink. The symlink exists on<br>
it's own. Creating the file that the symlink points to is an entirely<br>
separate step.<br>
<div><div class="h5"><br>
> I think, in hind sight, the problem is that there is no path specified for<br>
> the original file. Hence, the email I've just sent, suggests I could make<br>
> this mod:<br>
><br>
> - ( cd ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/ ; ln -sf<br>
> brcmfmac43430-sdio.MUR1DX.txt brcmfmac43430-sdio.txt)<br>
> + ( ln -sf<br>
> ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.MUR1DX.txt<br>
> ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.txt)<br>
><br>
><br>
><br>
>><br>
>><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>
>><br>
>> All as expected given that none of the symlink targets exist yet.<br>
>><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>
>><br>
>> You can't create a file within the foo/brcm subdirectory without<br>
>> creating that subdirectory first. You've somehow missed that step -<br>
>> although it was in my example.<br>
><br>
> Well, your example said:<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>
> ... and I was trying to show that it doesn't work. Although in fairness, you<br>
> did add the "mkdir -p foo/brcm" command in a later email. So I think we're<br>
> both arguing the same point and neither of us is making ourselves very<br>
> clear.<br>
><br>
> So I don't think we need to continue down this track. Martin's original<br>
> suggestion won't work for the reasons we've both just discussed. If I add<br>
> the absolute paths to the source and target, it should be fine.<br>
<br>
</div></div>If you make it down as far as the end of the previous email you'll<br>
find a simplified example of Martin's suggestion. Please try it. It<br>
does work.<br></blockquote><div><br></div><div>I think you're right. As was Martin.</div><div><br></div><div>I was starting to respond to your previous email but I'll cut it short and just say that I apologise for the confusion and distraction and I'll make the mod Martin suggested and test it works.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
><br>
>><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>
>> No real mysteries here. Everything looks as expected given the<br>
>> comments above about how you creating the target files.<br>
>><br>
>> > So, neither test1 nor test2 are linked to /tmp/test/test_target.<br>
>><br>
>> As expected. For a symlink which is in the foo subdirectory, the<br>
>> target would have to be "../test_target" to correctly point to your<br>
>> /tmp/test/test_target file.<br>
>><br>
>> > test1 is<br>
>> > linked to /tmp/test/foo/test_target<br>
>><br>
>> Not exactly. The test1 symlink in foo just points to "test_target",<br>
>> there's no absolute path.<br>
>><br>
>> ie if you renamed the foo directory to something else then the test1<br>
>> symlink would still point "test_target" and it would still be a valid<br>
>> link.<br>
>><br>
>> > and test2 is linked to<br>
>> > /tmp/test/brcm/test_target, which doesn't exist.<br>
>><br>
>> Again, test2 is a relative symlink, not absolute. The test2 symlink<br>
>> points to a target which doesn't exist due to a missing "mkdir -p<br>
>> foo/brcm" before you tried to create the target file.<br>
>><br>
>> > AFAIK, when creating a softlink, you have to give it either an absolute<br>
>> > path, or a path relative to the link being created. The path cannot be<br>
>> > relative to the original file that you want to link to.<br>
>><br>
>> The only real restriction when creating a symlink is that the<br>
>> directory which will contain the symlink must exist.<br>
>><br>
>> If you want the symlink to point to something then it's up to you to<br>
>> arrange that the target exists and the symlink points to it correctly<br>
>> - but the symlink can still be created even if the target doesn't<br>
>> point to anything valid.<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>
>> What's strange about it?<br>
>><br>
>> > AFAICT, for the recipe, to get rid of the "cd", I'd have to specify an<br>
>> > absolute path to the original file:<br>
>> ><br>
>> > +do_install_append_bcm43430-<wbr>nvram-mur1dx() {<br>
>> > + ( ln -sf ${PWD}/brcmfmac43430-sdio.<wbr>MUR1DX.txt<br>
>> > ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.txt)<br>
>> ><br>
>> > ... assuming PWD is available to the recipe. There will be a proper<br>
>> > Yocto<br>
>> > variable I can use, of course, but I can't think of it right now.<br>
>><br>
>> That definitely doesn't look right...<br>
>><br>
>> > Either way, Martin's example doesn't work for me. And adding the<br>
>> > absolute<br>
>> > path of the original file doesn't seem any neater or clearer than<br>
>> > following<br>
>> > the TI example from the do_install a few lines up in the recipe. But I'm<br>
>> > happy to do it either way, so long as it works.<br>
>><br>
>> Martin's example is basically saying (correctly) that this sequence:<br>
>><br>
>> mkdir foo<br>
>> echo hello > foo/target<br>
>> cd foo<br>
>> ln -sf target link<br>
>> cd ..<br>
>><br>
>> is equivalent to this one:<br>
>><br>
>> mkdir foo<br>
>> echo hello > foo/target<br>
>> ln -sf target foo/link<br>
>><br>
>> Notice that the first parameter to ln (the thing you want the symlink<br>
>> to point to) is the same in both cases. ie it isn't affected by which<br>
>> directory you are in when you create the symlink.<br>
</div></div></blockquote></div><br></div></div>