[U-Boot] [PATCH 1/8] fdtgrep: Improve error handling with invalid device tree

Simon Glass sjg at chromium.org
Sun Mar 13 02:51:50 CET 2016


On 7 March 2016 at 11:26, Simon Glass <sjg at chromium.org> wrote:
> Hi Joe,
>
> On 7 March 2016 at 09:42, Joe Hershberger <joe.hershberger at gmail.com> wrote:
>> On Mon, Mar 7, 2016 at 10:37 AM, Masahiro Yamada
>> <yamada.masahiro at socionext.com> wrote:
>>> 2016-03-07 12:31 GMT+09:00 Simon Glass <sjg at chromium.org>:
>>>> Hi Masahiro,
>>>>
>>>> On 6 March 2016 at 20:07, Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
>>>>> Hi Simon,
>>>>>
>>>>>
>>>>> 2016-03-07 11:45 GMT+09:00 Simon Glass <sjg at chromium.org>:
>>>>>> This tool requires that the aliases node be the first node in the tree. But
>>>>>> when it is not, it does not handle things gracefully. In fact it crashes.
>>>>>>
>>>>>> Fix this, and add a more helpful error message.
>>>>>>
>>>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>>>>> Reported-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>>>>>
>>>>>
>>>>> I think this patch would diplay a clearer hint,
>>>>> but would not solve the root cause.
>>>>>
>>>>>
>>>>>
>>>>> fdtgrep still crashes with the following DTS:
>>>>
>>>> Crashes?
>>>
>>> Yes.
>>
>> Perhaps a language barrier?
>>
>>> I applied your patch, but fdtgrep still would not work.
>>
>> True, but does not work and crashes are two different things.
>>
>>> Please try this.
>>>
>>>
>>
>> <snip>
>>
>>>   OBJCOPY spl/u-boot-spl-nodtb.bin
>>>   FDTGREP spl/u-boot-spl.dtb
>>> Error at 'fdt_find_regions': FDT_ERR_BADLAYOUT
>>> /aliases node must come before all other nodes
>>> Error: FDT_ERR_BADMAGIC
>>> make[1]: *** [spl/u-boot-spl.dtb] Error 1
>>> make: *** [spl/u-boot-spl] Error 2
>>
>> This is just an error. It's not an ideal limitation, but it's far
>> better than it was. I also bet Simon is going to send a v2 that fixes
>> it completely.
>
> Yes I hope to look at this some more. But I also feel that aliases
> should go at the top of the file...it seems odd to have the
> 'directory' at the bottom.
>
> Regards,
> Simon

I'm applying this since it fixes a crash.

Applied to u-boot-dm/next


More information about the U-Boot mailing list