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