[U-Boot] arm: wrong Relocation and not cleared BSS

Albert ARIBAUD albert.aribaud at free.fr
Tue Nov 2 08:41:06 CET 2010


Le 02/11/2010 08:18, V, Aneesh a écrit :

> Thanks. This helps. I did the .lds change and it seems to be booting
> now.

Good!

> However, I can't still explain my earlier observation because even in
> the absence of this fix .rel.dyn had some content and the offsets
> should have been different if I were to believe objdump.
>
> Do you have any clue?

There were two issues:

First, "older" linkers always emitted input relocation sections with the 
name ".rel.dyn" whereas "newer" linkers emitted them with names of the 
form ".rel*". As our linker files only took ".rel.dyn" to form the 
output section, using newer linkers would produce empty .rel.dyn sections.

Second, a fix to the first issue was RFCed to the list which worked on 
several boards but tx25 would not boot completely. The root cause of 
this second issue is that CONFIG_SYS_NAND_U_BOOT_SIZE in the board 
config file hard-codes the size of the u-boot binary that will be read 
from NAND and put in RAM. When/if u-boot grows in size, this constant 
must be adjusted, and it was not.

What hit you was the first issue for sure, and this explains why 
_rel_dyn_start_ofs and _rel_dyn_end_ofs are identical. What *could* have 
hit you was the second issue *if* your board boots from NAND *and* if 
u-boot grew beyond your CONFIG_SYS_NAND_U_BOOT_SIZE.

BTW, Wolfgang, couldn't this 'constant' be generated once objcopy has 
produced u-boot.bin? A script could 'du' its size, round it up as 
required, and generate a .h with the result so that the SPL would always 
compile with a correct value.

> Best regards,
> Aneesh

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list