[U-Boot] Selecting from multiple device trees at runtime

Simon Glass sjg at chromium.org
Tue Jan 8 17:51:20 CET 2013


Hi Stephen,

On Tue, Jan 8, 2013 at 8:42 AM, Stephen Warren <swarren at wwwdotorg.org> wrote:
> On 01/07/2013 08:16 PM, Simon Glass wrote:
>> Hi,
>>
>> On Mon, Jan 7, 2013 at 2:21 PM, Curt Brune <curt at cumulusnetworks.com> wrote:
>>>
>>>
>>> On 01/07/2013 12:12 PM, Wolfgang Denk wrote:
>>>>
>>>> Dear Curt Brune,
>>>>
>>>> In message <50EB0D92.2020707 at cumulusnetworks.com> you wrote:
>>>>>
>>>>>
>>>>> What I would love is to have a single multi-file uImage I could use on
>>>>> all my platforms.  The idea is to introduce a new image type that is a
>>>>> list of device tree blobs.
>>>>
>>>>
>>>> In addition to the file system based approach suggested by Stephen,
>>>> you should have a look into using FIT images (see doc/uImage.FIT/ ).
>>>> One of the reasons for creating these was to deal with situations
>>>> exactly as you describe...
>>>
>>>
>>> I think that will work perfectly.  Thank you for the suggestion.
>>
>> Note also there is code in mainline now to select the correct FDT from
>> a list of them in a FIT. based on the model name. Then it can pass
>> this to the kernel. So if you have a way of getting the model name in
>> U-Boot, it might just work.
>
> Hmmm. What's the model name compared against? U-Boot board name variable
> would be nice!

At the moment it compares against the model in the U-Boot FDT
(CONFIG_OF_CONTROL). When flashing a board, you pack u-boot.bin with
the selected .dtb file containing this model name. Then when U-Boot
runs it knows what its model is.

You could do what you describe, but it is then a compile-time check, I think.

There could be other ways to decide on the model name, such as looking
at strapping GPIOs, for example:

static const char *detect_model(void)
{
    if (gpio_get_value(36))
        return "snow";
    else
        return "flax";
}

>
> As a general comment here, I think the main issue Curt is facing is how
> to select the correct DT in U-Boot. Whether the n DTBs to be selected
> between are stored in a single FIT file, or stored in separate *.dtb
> files, seems pretty irrelevant to that core problem of how to select
> between them.

FIT selects between them already if you know the model - define
CONFIG_FIT_BEST_MATCH and it should work.

Regards,
Simon


More information about the U-Boot mailing list