Implementing a check on FDT header
list at c-mauderer.de
Mon Mar 5 19:48:19 UTC 2018
Am 05.03.2018 um 16:03 schrieb Udit agarwal:
> While going through uboot docs, i found something intresting:
> Here <https://www.denx.de/wiki/DULG/UBootCmdGroupExec>(Sec: 126.96.36.199), It
> is given that if FDT is not passed as the third argument to bootm
> command then, by default a data structure called bd_info(given here
> is passed instread of the pointer to fdt. Thus, the argument being
> passed to bsp_fdt_copy function during start.S shouldn't be random(or NULL).
I'm still not so sure here.
With bootm. This one calls the do_bootm_states() which in turn calls the
boot_selected_os() with a boot_fn as an argument (see  at the end of
The boot_fn can be one of the do_bootm_rtems() (see ) or
do_bootm_linux(). The later one is architecture specific. In our case it
would be .
So depending on whether you have build an RTEMS style image or a Linux
style image, you might get different values in the registers.
> Now, checking for the presence of bd_info can allow us to load an empty
> FDT in case of missing bootm param. I did load media01 test with empty
> FDT and it didn't crashed(Logs:here
> In case, if the FDT is loaded by the user, now we can implement a FDT
> header check to confirm it's validity.One possible way to do that could
> be via libfdt(there's a build in function that checks for magic number)
> as given in this
Most likely libfdt would be the right way.
> Other possible way(I am not sure about it) could be a validy check
> within uboot itself(Given here
> Moreover, I have a doubt, Why is uboot RTEMS format depreciated as per
> your discussions in previous threads?
It currently isn't. I only said that it might would be a good idea to
deprecate it somewhen in the near future. The reason for this is exactly
this kind of problem. We have multiple methods to boot and so we have to
find a solution that works for all of them. If we are fixed to one
method (like Linux style) it could be a lot simpler. One problem with
that could be that Linux seems to use a lot of formats for different
platforms. If we are running on a platform where there is no Linux
support we can't use Linux format. So a RTEMS might would be necessary
as a fallback for these platforms.
That's one of the points why I said: This topic might need some
discussion on the mailing list. It's great if you keep that discussion
running but it's purely optional for your GSoC project. So maybe you
shouldn't put too much energy into it before you have done most or all
of the mandatory things for your GSoC project. For example you should
think about a first draft for your proposal on the GSoC tracking page.
> Udit agarwal
More information about the devel