Implementing a check on FDT header

Udit agarwal dev.madaari at gmail.com
Mon Mar 5 15:03:55 UTC 2018


Hi,
While going through uboot docs, i found something intresting:
Here <https://www.denx.de/wiki/DULG/UBootCmdGroupExec>(Sec: 5.9.4.2), 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
<https://github.com/u-boot/u-boot/blob/53193a4f07c9e7a7d42493863712352cf16f1258/include/asm-generic/u-boot.h>)
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).
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
<https://gist.github.com/madaari/74ba18a375e320108587a0d29cda6985>).
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
<https://github.com/RTEMS/rtems/tree/5eb769ca8b553b4378a773967f08de20847794db/testsuites/libtests/libfdt01>
test. Other possible way(I am not sure about it) could be a validy check
within uboot itself(Given here
<https://lists.denx.de/pipermail/u-boot/2012-March/121281.html>).

Moreover, I have a doubt, Why is uboot RTEMS format depreciated as per your
discussions in previous threads?
Thanks!
Regards,
Udit agarwal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180305/f38943bd/attachment.html>


More information about the devel mailing list