[U-Boot] [RFC] arm926ejs: fix jump to RAM nand_boot

Heiko Schocher hs at denx.de
Tue Nov 2 08:10:02 CET 2010


Hello Albert,

Albert ARIBAUD wrote:
> Le 02/11/2010 07:29, Heiko Schocher a écrit :
> 
>> - 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
> 
> Heiko,
> 
> Since SPL is loaded in internal RAM, and since U-BOOT itself is loaded
> only in DRAM, why does SPL need to relocate itself? Can it not run
> entirely from IRAM and then jump to U-BOOT?

Good question. This was the old behaviour. Check this, if we can
prevent it.

> If SPL needs to relocate, then why does it run only the copy loop but
> not the fixups loop?

in nand_spl//nand_boot_fsl_nfc.c:

void board_init_f (ulong bootflag)
{
	relocate_code (CONFIG_SYS_TEXT_BASE - TOTAL_MALLOC_LEN, NULL,
		CONFIG_SYS_TEXT_BASE);
}

-> nand_spl code gets copied where it is compiled for ... no need
   for fixups.

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