[U-Boot] new uboot with relocation change cannot boot when download the bin file to different address than TEXT_BASE

Lei Wen adrian.wenl at gmail.com
Sat Oct 9 08:48:55 CEST 2010


On Sat, Oct 9, 2010 at 2:27 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
> On 09/10/10 16:50, Lei Wen wrote:
>> Hi,
>>
>> I recently try to port our board code to new uboot, which has been
>> changed to use new relocation scheme.
>> But I found a very strange thing, that is if the uboot is loaded to
>> the TEXT_BASE address, it could run without
>> problem. But if it is loaded to a different place, it fail to boot up...
>>
>> I check the code, and found that in the board_init_f, it calls the
>> init_sequence which is stored as a data sector
>> in the u-boot.bin file. While the new scheme use the fPIC, the code
>> could locate the GOT table correctly,
>> and it seem to forgot what the GOT table stores is context that is
>> meaningful in TEXT_BASE, not the loaded base.
>> That is to say, if the TEXT_BASE is 0xf00000, and loaded base is
>> 0x500000, I found the GOT table also filled
>> with 0xf0****, not the 0x50****. This leads the cpu loading wrong
>> function address in the init_sequence table, and
>> cause pc become invalid...
>>
>> Am I missing something to switch to the new relocation scheme?
>>
>
> The ARM relocation schemes (there are two being evaluated - one which uses
> .got and another .rel.dyn) are both designed to relocate from TEXT_BASE to
> an upper memory location determined during DRAM init
>
> x86 is the only arch that I know implements what you are describing (in a
> patch series in u-boot-x86/master but not yet in mainline)
>
Glad to know this info here. :-)
But it let the uboot lose a good feature that let it boot itself to
debug a new feature.
In original scheme, the relocate operation is done before calling the
init_sequence,
so the problem here was gone.

So for the new relocation scheme currently on mainline code, we only could load
the u-boot.bin to the TEXT_BASE in ram and transfer the control to it?
And if do this, the relocate seems has no meaning here, since in the
past experience
we need the relocation for we need copy the rest of uboot code to the TEXT_BASE
when start up at a different place at the very beginning.

Thanks,
Lei


More information about the U-Boot mailing list