[U-Boot] [RFC] arm926ejs: fix jump to RAM nand_boot
Heiko Schocher
hs at denx.de
Tue Nov 2 07:29:56 CET 2010
Hello Wolfgang,
Wolfgang Denk wrote:
> Dear Albert ARIBAUD,
>
> In message <4CCEF2E4.5080003 at free.fr> you wrote:
>> Also, I understand why the second RFC change I did was harmful to tx25.
>> Contrary to u-boot itself, u-boot-spl is not compiled to be position
>> independent; it actually loads at a given address then copies itself,
>> without relocating, to its home location.
>
> It copies _itself_? Not the U-Boot payload?
>
> Heiko, is this intentional? Do we really first load the whole image,
> then copy the U-Boot payload to some other address, then relocate it
> to yet another one?
- preloader copies first page of nand (nand_spl code) to
0xbb000000 (some cpu internal mem) and jumps to this address
- nand_spl does lowlevelinit, relocate itself to TEXT_BASE (nand_spl code)
- from there, it copies u-boot code from nand to CONFIG_SYS_NAND_U_BOOT_DST
and jumps to CONFIG_SYS_NAND_U_BOOT_START
- u-boot run into board_init_f, calculates new relocation address
and relocates ...
But there is a possibility to prevent one copy, if TEXT_BASE =
relocation address = CONFIG_SYS_NAND_U_BOOT_DST
In this case nand_spl code copies u-boot from nand to
CONFIG_SYS_NAND_U_BOOT_DST. As this is equal to the relocation address,
no need to copy code in relocate_code().
But as codesize changes (and with it relocation address) this
is not a perfect solution.
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list