<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">&lt;<a href="mailto:armccurdy@gmail.com" target="_blank">armccurdy@gmail.com</a>&gt;</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 &lt;<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>&gt; wrote:<br>
&gt; On 23 August 2018 at 08:06, Andre McCurdy &lt;<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>&gt; wrote:<br>
&gt;&gt; On Wed, Aug 22, 2018 at 11:12 PM, Ryan Harkin &lt;<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; On 22 August 2018 at 23:55, Andre McCurdy &lt;<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt;&gt; On Wed, Aug 22, 2018 at 2:56 PM, Ryan Harkin &lt;<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; On Wed, 22 Aug 2018, 21:42 Andre McCurdy, &lt;<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; On Wed, Aug 22, 2018 at 1:10 PM, Ryan Harkin<br>
&gt;&gt; &gt;&gt; &gt;&gt; &lt;<a href="mailto:ryan.harkin@linaro.org">ryan.harkin@linaro.org</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; On Wed, 22 Aug 2018, 20:02 Martin Jansa, &lt;<a href="mailto:martin.jansa@gmail.com">martin.jansa@gmail.com</a>&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; Your 1st parameter is wrong, compare again with the example I<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; gave<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; you<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; (don&#39;t include &quot;brcm/&quot; path in 1st param, because you want the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; symlink<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; to<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; point to just brcmfmac43430-sdio.AP6212.txt like you did in the<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; version<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;&gt; after cd).<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; That doesn&#39;t work either. I tried it with the same result, but<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; didn&#39;t<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; send a<br>
&gt;&gt; &gt;&gt; &gt;&gt; &gt; log of it. That works for you?<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; Martin&#39;s example is correct so maybe check your tests again for<br>
&gt;&gt; &gt;&gt; &gt;&gt; typos.<br>
&gt;&gt; &gt;&gt; &gt;&gt; It it still doesn&#39;t work then please do send a log.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt; The link will point to whatever you define via the first parameter,<br>
&gt;&gt; &gt;&gt; &gt;&gt; so<br>
&gt;&gt; &gt;&gt; &gt;&gt; if you changed the first parameter it shouldn&#39;t be possible to get<br>
&gt;&gt; &gt;&gt; &gt;&gt; &quot;the same result&quot;.<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;   $ mkdir foo<br>
&gt;&gt; &gt;&gt; &gt;&gt;   $ ln -sf test_target foo/test1<br>
&gt;&gt; &gt;&gt; &gt;&gt;   $ ln -sf brcm/test_target foo/test2<br>
&gt;&gt; &gt;&gt; &gt;&gt;   $ ls -l foo<br>
&gt;&gt; &gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt;&gt;   lrwxrwxrwx 1 andre andre 11 Aug 22 13:35 test1 -&gt; test_target<br>
&gt;&gt; &gt;&gt; &gt;&gt;   lrwxrwxrwx 1 andre andre 16 Aug 22 13:35 test2 -&gt; brcm/test_target<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Yes, that&#39;s essentially the same as what I&#39;m getting.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Now try &quot;cat foo/test1&quot; and what happens?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; There is no file called test_target in the foo directory. And neither<br>
&gt;&gt; &gt;&gt; &gt; is<br>
&gt;&gt; &gt;&gt; &gt; there a file called brcm/test_target in the foo directory.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Correct. The above was just an example to show that you can * create<br>
&gt;&gt; &gt;&gt; symlinks * in the foo directory without cd&#39;ing into the foo directory<br>
&gt;&gt; &gt;&gt; first.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; If you&#39;d like the symlinks in the example to point to valid targets<br>
&gt;&gt; &gt;&gt; then you need to create the targets too, e.g.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;   $ mkdir -p foo/brcm<br>
&gt;&gt; &gt;&gt;   $ echo hello &gt; foo/test_target<br>
&gt;&gt; &gt;&gt;   $ echo hello2 &gt; foo/brcm/test_target<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; But note that the process of creating a symlink is always the same,<br>
&gt;&gt; &gt;&gt; regardless of whether the symlink points to a valid target or not (so<br>
&gt;&gt; &gt;&gt; you can run these extra commands to create the targets before or after<br>
&gt;&gt; &gt;&gt; you create the symlinks).<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; So that doesn&#39;t work for me how I expect it to work. I must be missing<br>
&gt;&gt; &gt; something fundamental here.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; The recipe is trying to create a soft link from a file in the current<br>
&gt;&gt; &gt; directory to a file in the sub-directory. On my system, your example<br>
&gt;&gt; &gt; creates<br>
&gt;&gt; &gt; links from a file in the sub-directory to the another file in the<br>
&gt;&gt; &gt; sub-directory.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; So, to copy your example, but creating the file &quot;test_target&quot; from the<br>
&gt;&gt; &gt; start:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; $ mkdir -p /tmp/test<br>
&gt;&gt; &gt; $ cd /tmp/test<br>
&gt;&gt; &gt; $ mkdir foo<br>
&gt;&gt; &gt; $ echo 1 &gt; test_target<br>
&gt;&gt;<br>
&gt;&gt; Here you are creating &quot;test_target&quot; in the directory which contains<br>
&gt;&gt; foo, not inside foo. So a symlink inside foo pointing to &quot;test_target&quot;<br>
&gt;&gt; isn&#39;t going to work.<br>
&gt;<br>
&gt; Exactly my point! Martin asked me to do this:<br>
&gt;<br>
&gt;&gt; ln -sf brcmfmac43430-sdio.AP6212.txt<br>
&gt;&gt; ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.txt<br>
&gt;<br>
&gt; Which is in essence what I&#39;m doing above. It won&#39;t work. The file<br>
&gt; &quot;brcmfmac43430-sdio.AP6212.<wbr>txt&quot; doesn&#39;t exist in the current directory.<br>
&gt; That&#39;s why there&#39;s a &quot;cd&quot; command in there.<br>
<br>
</div></div>I think you&#39;re really still quite confused about something here...<br>
<br>
You don&#39;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&#39;s own. Creating the file that the symlink points to is an entirely<br>
separate step.<br>
<div><div class="h5"><br>
&gt; I think, in hind sight, the problem is that there is no path specified for<br>
&gt; the original file. Hence, the email I&#39;ve just sent, suggests I could make<br>
&gt; this mod:<br>
&gt;<br>
&gt; -       ( cd ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/ ; ln -sf<br>
&gt; brcmfmac43430-sdio.MUR1DX.txt brcmfmac43430-sdio.txt)<br>
&gt; +      ( ln -sf<br>
&gt; ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.MUR1DX.txt<br>
&gt; ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.txt)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; $ ln -sf test_target foo/test1<br>
&gt;&gt; &gt; $ ln -sf brcm/test_target foo/test2<br>
&gt;&gt; &gt; $ ls -l foo<br>
&gt;&gt; &gt; total 0<br>
&gt;&gt; &gt; lrwxrwxrwx 1 ryan ryan 11 Aug 23 06:54 test1 -&gt; test_target<br>
&gt;&gt; &gt; lrwxrwxrwx 1 ryan ryan 16 Aug 23 06:54 test2 -&gt; brcm/test_target<br>
&gt;&gt; &gt; $ cat test_target<br>
&gt;&gt; &gt; 1<br>
&gt;&gt; &gt; $ cat foo/test1<br>
&gt;&gt; &gt; cat: foo/test1: No such file or directory<br>
&gt;&gt; &gt; $ cat foo/test2<br>
&gt;&gt; &gt; cat: foo/test2: No such file or directory<br>
&gt;&gt;<br>
&gt;&gt; All as expected given that none of the symlink targets exist yet.<br>
&gt;&gt;<br>
&gt;&gt; &gt; $ echo hello &gt; foo/test_target<br>
&gt;&gt; &gt; $ echo hello2 &gt; foo/brcm/test_target<br>
&gt;&gt; &gt; bash: foo/brcm/test_target: No such file or directory<br>
&gt;&gt;<br>
&gt;&gt; You can&#39;t create a file within the foo/brcm subdirectory without<br>
&gt;&gt; creating that subdirectory first. You&#39;ve somehow missed that step -<br>
&gt;&gt; although it was in my example.<br>
&gt;<br>
&gt; Well, your example said:<br>
&gt;<br>
&gt;&gt;  $ mkdir foo<br>
&gt;&gt;  $ ln -sf test_target foo/test1<br>
&gt;&gt;  $ ln -sf brcm/test_target foo/test2<br>
&gt;&gt;  $ ls -l foo<br>
&gt;<br>
&gt; ... and I was trying to show that it doesn&#39;t work. Although in fairness, you<br>
&gt; did add the &quot;mkdir -p foo/brcm&quot; command in a later email. So I think we&#39;re<br>
&gt; both arguing the same point and neither of us is making ourselves very<br>
&gt; clear.<br>
&gt;<br>
&gt; So I don&#39;t think we need to continue down this track. Martin&#39;s original<br>
&gt; suggestion won&#39;t work for the reasons we&#39;ve both just discussed. If I add<br>
&gt; 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&#39;ll<br>
find a simplified example of Martin&#39;s suggestion. Please try it. It<br>
does work.<br></blockquote><div><br></div><div>I think you&#39;re right. As was Martin.</div><div><br></div><div>I was starting to respond to your previous email but I&#39;ll cut it short and just say that I apologise for the confusion and distraction and I&#39;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>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt; $ cat foo/test1<br>
&gt;&gt; &gt; hello<br>
&gt;&gt; &gt; $ cat foo/test2<br>
&gt;&gt; &gt; cat: foo/test2: No such file or directory<br>
&gt;&gt; &gt; $ cat test_target<br>
&gt;&gt; &gt; 1<br>
&gt;&gt; &gt; $ tree<br>
&gt;&gt; &gt; .<br>
&gt;&gt; &gt; ├── foo<br>
&gt;&gt; &gt; │   ├── test1 -&gt; test_target<br>
&gt;&gt; &gt; │   ├── test2 -&gt; brcm/test_target<br>
&gt;&gt; &gt; │   └── test_target<br>
&gt;&gt; &gt; └── test_target<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; 1 directory, 4 files<br>
&gt;&gt;<br>
&gt;&gt; No real mysteries here. Everything looks as expected given the<br>
&gt;&gt; comments above about how you creating the target files.<br>
&gt;&gt;<br>
&gt;&gt; &gt; So, neither test1 nor test2 are linked to /tmp/test/test_target.<br>
&gt;&gt;<br>
&gt;&gt; As expected. For a symlink which is in the foo subdirectory, the<br>
&gt;&gt; target would have to be &quot;../test_target&quot; to correctly point to your<br>
&gt;&gt; /tmp/test/test_target file.<br>
&gt;&gt;<br>
&gt;&gt; &gt; test1 is<br>
&gt;&gt; &gt; linked to /tmp/test/foo/test_target<br>
&gt;&gt;<br>
&gt;&gt; Not exactly. The test1 symlink in foo just points to &quot;test_target&quot;,<br>
&gt;&gt; there&#39;s no absolute path.<br>
&gt;&gt;<br>
&gt;&gt; ie if you renamed the foo directory to something else then the test1<br>
&gt;&gt; symlink would still point &quot;test_target&quot; and it would still be a valid<br>
&gt;&gt; link.<br>
&gt;&gt;<br>
&gt;&gt; &gt; and test2 is linked to<br>
&gt;&gt; &gt; /tmp/test/brcm/test_target, which doesn&#39;t exist.<br>
&gt;&gt;<br>
&gt;&gt; Again, test2 is a relative symlink, not absolute. The test2 symlink<br>
&gt;&gt; points to a target which doesn&#39;t exist due to a missing &quot;mkdir -p<br>
&gt;&gt; foo/brcm&quot; before you tried to create the target file.<br>
&gt;&gt;<br>
&gt;&gt; &gt; AFAIK, when creating a softlink, you have to give it either an absolute<br>
&gt;&gt; &gt; path, or a path relative to the link being created. The path cannot be<br>
&gt;&gt; &gt; relative to the original file that you want to link to.<br>
&gt;&gt;<br>
&gt;&gt; The only real restriction when creating a symlink is that the<br>
&gt;&gt; directory which will contain the symlink must exist.<br>
&gt;&gt;<br>
&gt;&gt; If you want the symlink to point to something then it&#39;s up to you to<br>
&gt;&gt; arrange that the target exists and the symlink points to it correctly<br>
&gt;&gt; - but the symlink can still be created even if the target doesn&#39;t<br>
&gt;&gt; point to anything valid.<br>
&gt;&gt;<br>
&gt;&gt; &gt; So, this will work:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; $cd /tmp/test<br>
&gt;&gt; &gt; $ ln -sf ../test_target foo/test3<br>
&gt;&gt; &gt; $ cat foo/test3<br>
&gt;&gt; &gt; 1<br>
&gt;&gt; &gt; $ cat /tmp/test/foo/test3<br>
&gt;&gt; &gt; 1<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; But that is a strange way to create the soft link, IMO.<br>
&gt;&gt;<br>
&gt;&gt; What&#39;s strange about it?<br>
&gt;&gt;<br>
&gt;&gt; &gt; AFAICT, for the recipe, to get rid of the &quot;cd&quot;, I&#39;d have to specify an<br>
&gt;&gt; &gt; absolute path to the original file:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; +do_install_append_bcm43430-<wbr>nvram-mur1dx() {<br>
&gt;&gt; &gt; +       ( ln -sf ${PWD}/brcmfmac43430-sdio.<wbr>MUR1DX.txt<br>
&gt;&gt; &gt; ${D}${nonarch_base_libdir}/<wbr>firmware/brcm/brcmfmac43430-<wbr>sdio.txt)<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; ... assuming PWD is available to the recipe. There will be a proper<br>
&gt;&gt; &gt; Yocto<br>
&gt;&gt; &gt; variable I can use, of course, but I can&#39;t think of it right now.<br>
&gt;&gt;<br>
&gt;&gt; That definitely doesn&#39;t look right...<br>
&gt;&gt;<br>
&gt;&gt; &gt; Either way, Martin&#39;s example doesn&#39;t work for me. And adding the<br>
&gt;&gt; &gt; absolute<br>
&gt;&gt; &gt; path of the original file doesn&#39;t seem any neater or clearer than<br>
&gt;&gt; &gt; following<br>
&gt;&gt; &gt; the TI example from the do_install a few lines up in the recipe. But I&#39;m<br>
&gt;&gt; &gt; happy to do it either way, so long as it works.<br>
&gt;&gt;<br>
&gt;&gt; Martin&#39;s example is basically saying (correctly) that this sequence:<br>
&gt;&gt;<br>
&gt;&gt;   mkdir foo<br>
&gt;&gt;   echo hello &gt; foo/target<br>
&gt;&gt;   cd foo<br>
&gt;&gt;   ln -sf target link<br>
&gt;&gt;   cd ..<br>
&gt;&gt;<br>
&gt;&gt; is equivalent to this one:<br>
&gt;&gt;<br>
&gt;&gt;   mkdir foo<br>
&gt;&gt;   echo hello &gt; foo/target<br>
&gt;&gt;   ln -sf target foo/link<br>
&gt;&gt;<br>
&gt;&gt; Notice that the first parameter to ln (the thing you want the symlink<br>
&gt;&gt; to point to) is the same in both cases. ie it isn&#39;t affected by which<br>
&gt;&gt; directory you are in when you create the symlink.<br>
</div></div></blockquote></div><br></div></div>