From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] new uboot with relocation change cannot boot when download the bin file to different address than TEXT_BASE
Date: Sat, 09 Oct 2010 10:10:55 +0200 [thread overview]
Message-ID: <4CB0238F.8090702@free.fr> (raw)
In-Reply-To: <AANLkTi=G3EYs8UJx9cp7Kj+kE-wE7TvO2ftOKVC2LG9T@mail.gmail.com>
Le 09/10/2010 09:53, Lei Wen a ?crit :
> Hi Albert,
>
> On Sat, Oct 9, 2010 at 3:43 PM, Albert ARIBAUD<albert.aribaud@free.fr> wrote:
>> Le 09/10/2010 07:50, Lei Wen a ?crit :
>>> 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?
>>>
>>> Thanks,
>>> Lei
>>
>> Can you indicate which hardware (architecture, cpu, SoC, etc) you're
>> running this code on?
>>
> I am running the code on Marvell aspen soc, which is arm926ejs compatible core.
For arm926, TEXT_BASE should be the FLASH location (if booting from NOR)
or a location in DRAM (for NAND and other methods).
I have had little difficulty in running the .got relocation code in a
Marvell oront5x (arm926ejs too), except for some functions called from
board_init_f which did not respect the general rule that code run before
relocation should only access gd; one place in orion5x wrote to global
variables, which always was a no-no and only happened to work because
the arm926ejs init sequence did not run in proper order.
However, .got relocation has shortcomings of its own; mainly, it
requires manual fixups in many places within the code. I have provided
patches which replace .got relocation with ELF relocation (look up
[ELF-RELOC] tags in the posts), which eliminates the need for any manual
fixup; you may want to try this, as it might eventually replace the .got
patches.
> Best regards,
> Lei
Amicalement,
--
Albert.
next prev parent reply other threads:[~2010-10-09 8:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-09 5:50 [U-Boot] new uboot with relocation change cannot boot when download the bin file to different address than TEXT_BASE Lei Wen
2010-10-09 6:27 ` Graeme Russ
2010-10-09 6:48 ` Lei Wen
2010-10-09 17:50 ` Wolfgang Denk
2010-10-10 4:33 ` Lei Wen
2010-10-10 6:48 ` Albert ARIBAUD
2010-10-10 6:50 ` Wolfgang Denk
2010-10-10 9:00 ` Lei Wen
2010-10-09 7:43 ` Albert ARIBAUD
2010-10-09 7:53 ` Lei Wen
2010-10-09 8:10 ` Albert ARIBAUD [this message]
2010-10-09 8:18 ` Albert ARIBAUD
2010-10-09 8:24 ` Lei Wen
2010-10-09 8:57 ` Albert ARIBAUD
2010-10-09 9:08 ` Lei Wen
2010-10-09 9:23 ` Albert ARIBAUD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CB0238F.8090702@free.fr \
--to=albert.aribaud@free.fr \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox