[OE-core] [RFC 3/3] linux-firmware: MACHINEOVERRIDES for BCM43430 NVRAM

Andre McCurdy armccurdy at gmail.com
Thu Aug 23 07:34:31 UTC 2018


On Thu, Aug 23, 2018 at 12:17 AM, Ryan Harkin <ryan.harkin at linaro.org> wrote:
> On 23 August 2018 at 08:06, Andre McCurdy <armccurdy at gmail.com> wrote:
>> On Wed, Aug 22, 2018 at 11:12 PM, Ryan Harkin <ryan.harkin at linaro.org>
>> wrote:
>> > On 22 August 2018 at 23:55, Andre McCurdy <armccurdy at gmail.com> wrote:
>> >> On Wed, Aug 22, 2018 at 2:56 PM, Ryan Harkin <ryan.harkin at linaro.org>
>> >> wrote:
>> >> > On Wed, 22 Aug 2018, 21:42 Andre McCurdy, <armccurdy at gmail.com>
>> >> > wrote:
>> >> >> On Wed, Aug 22, 2018 at 1:10 PM, Ryan Harkin
>> >> >> <ryan.harkin at linaro.org>
>> >> >> wrote:
>> >> >> > On Wed, 22 Aug 2018, 20:02 Martin Jansa, <martin.jansa at gmail.com>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Your 1st parameter is wrong, compare again with the example I
>> >> >> >> gave
>> >> >> >> you
>> >> >> >> (don't include "brcm/" path in 1st param, because you want the
>> >> >> >> symlink
>> >> >> >> to
>> >> >> >> point to just brcmfmac43430-sdio.AP6212.txt like you did in the
>> >> >> >> version
>> >> >> >> after cd).
>> >> >> >
>> >> >> > That doesn't work either. I tried it with the same result, but
>> >> >> > didn't
>> >> >> > send a
>> >> >> > log of it. That works for you?
>> >> >>
>> >> >> Martin's example is correct so maybe check your tests again for
>> >> >> typos.
>> >> >> It it still doesn't work then please do send a log.
>> >> >>
>> >> >> The link will point to whatever you define via the first parameter,
>> >> >> so
>> >> >> if you changed the first parameter it shouldn't be possible to get
>> >> >> "the same result".
>> >> >>
>> >> >>   $ mkdir foo
>> >> >>   $ ln -sf test_target foo/test1
>> >> >>   $ ln -sf brcm/test_target foo/test2
>> >> >>   $ ls -l foo
>> >> >>
>> >> >>   lrwxrwxrwx 1 andre andre 11 Aug 22 13:35 test1 -> test_target
>> >> >>   lrwxrwxrwx 1 andre andre 16 Aug 22 13:35 test2 -> brcm/test_target
>> >> >
>> >> > Yes, that's essentially the same as what I'm getting.
>> >> >
>> >> > Now try "cat foo/test1" and what happens?
>> >> >
>> >> > There is no file called test_target in the foo directory. And neither
>> >> > is
>> >> > there a file called brcm/test_target in the foo directory.
>> >>
>> >> Correct. The above was just an example to show that you can * create
>> >> symlinks * in the foo directory without cd'ing into the foo directory
>> >> first.
>> >>
>> >> If you'd like the symlinks in the example to point to valid targets
>> >> then you need to create the targets too, e.g.
>> >>
>> >>   $ mkdir -p foo/brcm
>> >>   $ echo hello > foo/test_target
>> >>   $ echo hello2 > foo/brcm/test_target
>> >>
>> >> But note that the process of creating a symlink is always the same,
>> >> regardless of whether the symlink points to a valid target or not (so
>> >> you can run these extra commands to create the targets before or after
>> >> you create the symlinks).
>> >
>> > So that doesn't work for me how I expect it to work. I must be missing
>> > something fundamental here.
>> >
>> > 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.
>> >
>> > So, to copy your example, but creating the file "test_target" from the
>> > start:
>> >
>> > $ mkdir -p /tmp/test
>> > $ cd /tmp/test
>> > $ mkdir foo
>> > $ echo 1 > test_target
>>
>> Here you are creating "test_target" in the directory which contains
>> foo, not inside foo. So a symlink inside foo pointing to "test_target"
>> isn't going to work.
>
> Exactly my point! Martin asked me to do this:
>
>> ln -sf brcmfmac43430-sdio.AP6212.txt
>> ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.txt
>
> Which is in essence what I'm doing above. It won't work. The file
> "brcmfmac43430-sdio.AP6212.txt" doesn't exist in the current directory.
> That's why there's a "cd" command in there.

I think you're really still quite confused about something here...

You don't need to have any file existing in the current directory (or
anywhere else) in order to create a symlink. The symlink exists on
it's own. Creating the file that the symlink points to is an entirely
separate step.

> I think, in hind sight, the problem is that there is no path specified for
> the original file. Hence, the email I've just sent, suggests I could make
> this mod:
>
> -       ( cd ${D}${nonarch_base_libdir}/firmware/brcm/ ; ln -sf
> brcmfmac43430-sdio.MUR1DX.txt brcmfmac43430-sdio.txt)
> +      ( ln -sf
> ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.MUR1DX.txt
> ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.txt)
>
>
>
>>
>>
>> > $ ln -sf test_target foo/test1
>> > $ ln -sf brcm/test_target foo/test2
>> > $ ls -l foo
>> > total 0
>> > lrwxrwxrwx 1 ryan ryan 11 Aug 23 06:54 test1 -> test_target
>> > lrwxrwxrwx 1 ryan ryan 16 Aug 23 06:54 test2 -> brcm/test_target
>> > $ cat test_target
>> > 1
>> > $ cat foo/test1
>> > cat: foo/test1: No such file or directory
>> > $ cat foo/test2
>> > cat: foo/test2: No such file or directory
>>
>> All as expected given that none of the symlink targets exist yet.
>>
>> > $ echo hello > foo/test_target
>> > $ echo hello2 > foo/brcm/test_target
>> > bash: foo/brcm/test_target: No such file or directory
>>
>> You can't create a file within the foo/brcm subdirectory without
>> creating that subdirectory first. You've somehow missed that step -
>> although it was in my example.
>
> Well, your example said:
>
>>  $ mkdir foo
>>  $ ln -sf test_target foo/test1
>>  $ ln -sf brcm/test_target foo/test2
>>  $ ls -l foo
>
> ... and I was trying to show that it doesn't work. Although in fairness, you
> did add the "mkdir -p foo/brcm" command in a later email. So I think we're
> both arguing the same point and neither of us is making ourselves very
> clear.
>
> So I don't think we need to continue down this track. Martin's original
> suggestion won't work for the reasons we've both just discussed. If I add
> the absolute paths to the source and target, it should be fine.

If you make it down as far as the end of the previous email you'll
find a simplified example of Martin's suggestion. Please try it. It
does work.

>
>>
>> > $ cat foo/test1
>> > hello
>> > $ cat foo/test2
>> > cat: foo/test2: No such file or directory
>> > $ cat test_target
>> > 1
>> > $ tree
>> > .
>> > ├── foo
>> > │   ├── test1 -> test_target
>> > │   ├── test2 -> brcm/test_target
>> > │   └── test_target
>> > └── test_target
>> >
>> > 1 directory, 4 files
>>
>> No real mysteries here. Everything looks as expected given the
>> comments above about how you creating the target files.
>>
>> > So, neither test1 nor test2 are linked to /tmp/test/test_target.
>>
>> As expected. For a symlink which is in the foo subdirectory, the
>> target would have to be "../test_target" to correctly point to your
>> /tmp/test/test_target file.
>>
>> > test1 is
>> > linked to /tmp/test/foo/test_target
>>
>> Not exactly. The test1 symlink in foo just points to "test_target",
>> there's no absolute path.
>>
>> ie if you renamed the foo directory to something else then the test1
>> symlink would still point "test_target" and it would still be a valid
>> link.
>>
>> > and test2 is linked to
>> > /tmp/test/brcm/test_target, which doesn't exist.
>>
>> Again, test2 is a relative symlink, not absolute. The test2 symlink
>> points to a target which doesn't exist due to a missing "mkdir -p
>> foo/brcm" before you tried to create the target file.
>>
>> > 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.
>>
>> The only real restriction when creating a symlink is that the
>> directory which will contain the symlink must exist.
>>
>> If you want the symlink to point to something then it's up to you to
>> arrange that the target exists and the symlink points to it correctly
>> - but the symlink can still be created even if the target doesn't
>> point to anything valid.
>>
>> > So, this will work:
>> >
>> > $cd /tmp/test
>> > $ ln -sf ../test_target foo/test3
>> > $ cat foo/test3
>> > 1
>> > $ cat /tmp/test/foo/test3
>> > 1
>> >
>> > But that is a strange way to create the soft link, IMO.
>>
>> What's strange about it?
>>
>> > AFAICT, for the recipe, to get rid of the "cd", I'd have to specify an
>> > absolute path to the original file:
>> >
>> > +do_install_append_bcm43430-nvram-mur1dx() {
>> > +       ( ln -sf ${PWD}/brcmfmac43430-sdio.MUR1DX.txt
>> > ${D}${nonarch_base_libdir}/firmware/brcm/brcmfmac43430-sdio.txt)
>> >
>> > ... 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.
>>
>> That definitely doesn't look right...
>>
>> > 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.
>>
>> Martin's example is basically saying (correctly) that this sequence:
>>
>>   mkdir foo
>>   echo hello > foo/target
>>   cd foo
>>   ln -sf target link
>>   cd ..
>>
>> is equivalent to this one:
>>
>>   mkdir foo
>>   echo hello > foo/target
>>   ln -sf target foo/link
>>
>> Notice that the first parameter to ln (the thing you want the symlink
>> to point to) is the same in both cases. ie it isn't affected by which
>> directory you are in when you create the symlink.



More information about the Openembedded-core mailing list