[U-Boot-Users] fixup section problem.

Txema Lopez tlopez at aotek.es
Thu Nov 2 10:21:07 CET 2006


Hi,

We are working in a MPC5200B based custom board and we are developping a 
tool to relocate a U-Boot (1.1.4 version) binary file to a different 
address in flash that it was linked. So, we have to change  the GOT and 
FIXUP entries in the original file to point at the new address. Doing 
this work, we have found that, surprisingly, the FIXUP section in U-Boot 
is empty. When U-Boot is relocated from flash to sdram these lines in 
the file start.S have no effect:
    /*
     * Now adjust the fixups and the pointers to the fixups
     * in case we need to move ourselves again.
     */
2:    li    r0,__fixup_entries at sectoff@l
    lwz    r3,GOT(_FIXUP_TABLE_)
    cmpwi    r0,0
    mtctr    r0
    addi    r3,r3,-4
    beq    4f
3:    lwzu    r4,4(r3)
    lwzux    r0,r4,r11
    add    r0,r0,r11
    stw    r10,0(r3)
    stw    r0,0(r4)
    bdnz    3b
4:
Looking into the sources we have found some places where the fixup 
elements seem to be relocated manually, i.e.:
void malloc_bin_reloc (void)
{
    DECLARE_GLOBAL_DATA_PTR;

    unsigned long *p = (unsigned long *)(&av_[2]);
    int i;
   
    for (i=2; i<(sizeof(av_)/sizeof(mbinptr)); ++i) {
        *p++ += gd->reloc_off;
    }
}
Is there any reason to leave the FIXUP section empty in U-Boot? Is it a 
bug?.

Checking the u-boot.lds file for the IceCube board we have found that 
fhe fixup section is included in the TEXT section and in the RELOC 
section, but the linker generate code only for the TEXT section. If we 
put it only in the RELOC section the FIXUP is not empty, the pointers 
adjustement in the start.S seems to work properly and the 
malloc_bin_reloc() function would be not necessary. Does anynone know if 
I'am missing something?

Any clue will be welcomed.
Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlopez.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20061102/6d27a20a/attachment.vcf 


More information about the U-Boot mailing list