[U-Boot] fdt_resize() bug caused "WARNING: could not set linux, initrd-start FDT_ERR_NOSPACE."
Wang, Feng
fwang02 at harris.com
Wed Jun 23 20:20:48 CEST 2010
Hello,
This is Feng Wang from Harris Corp. I am new to the mailing list. I have
been using u-boot for half year now, and just found a bug in the libfdt
support for PowerPC. Not sure if that's the way to report a bug fix.
What I got is an error: "WARNING: could not set linux,initrd-start
FDT_ERR_NOSPACE." after loading Device Tree blob. This in turn caused
linux to miss init part.
After some digging, I found out the reason for this error, it is caused
by fdt_resize().
FDT blob got resized after filling in all board specific information of
PowerPC. (in boot_body_linux()). It reduced blob size with only extra
space for two fdt_reserve_entry, one for fdt itself, and one for initrd.
Then it's aligned to a 0x1000 page boundary. However, later in
fdt_initrd(), it could add two more properties, initrd-start AND
initrd-end, each one needs at least two fdt_reserve_entry sizes done by
_fdt_add_property() (name and value). Thus, the two fdt_reserve_entry
extra space is not sufficient.
So for some specific fdt size which is just under the page boundary
after resizing, this will cause an error of FDT_ERR_NOSPACE in
fdt_initrd() when setting those two properties, and failed to pass
initrd information to linux.
My fix is in fdt_resize(), leave at least 4 fdt_reserve_entry for
initrd. So instead of 2*sizeof(struct fdt_reserve_entry) for
actual_totalsize, use 5*sizeof(struc fdt_reserve_entry).
Another potential fix is to move fdt_resize() after the fdt_initrd()
call in fdt_support.c
Best regards,
Feng Wang
More information about the U-Boot
mailing list