[U-Boot] [PATCH 12/26 v2][NEXT] ARM: add relocation support

Heiko Schocher
2010-09-19T11:56:30Z

Hello Wolfgang,

Wolfgang Denk wrote:
> Dear Heiko Schocher,
>
> In message <1284721853-8298-13-git-send-email-hs@denx.de> you wrote:
>> !! This breaks support for all arm boards !!
>
> Not only that...
>
> ...
>> diff --git a/nand_spl/nand_boot.c b/nand_spl/nand_boot.c
>> index b9fd6f5..18ecbe1 100644
>> --- a/nand_spl/nand_boot.c
>> +++ b/nand_spl/nand_boot.c
>> @@ -221,6 +221,13 @@ static int nand_load(struct mtd_info *mtd, unsigned int offs,
>> return 0;
>> }
>>
>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>> +void board_init_f (ulong bootflag)
>> +{
>> + relocate_code (TEXT_BASE - TOTAL_MALLOC_LEN, NULL, TEXT_BASE);
>> +}
>> +#endif
>> +
>> /*
>> * The main entry for NAND booting. It's necessary that SDRAM is already
>> * configured and available since this code loads the main U-Boot image
>> diff --git a/nand_spl/nand_boot_fsl_nfc.c b/nand_spl/nand_boot_fsl_nfc.c
>> index ea3566b..3105657 100644
>> --- a/nand_spl/nand_boot_fsl_nfc.c
>> +++ b/nand_spl/nand_boot_fsl_nfc.c
>> @@ -263,6 +263,13 @@ static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)
>> return 0;
>> }
>>
>> +#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>> +void board_init_f (ulong bootflag)
>> +{
>> + relocate_code (TEXT_BASE - TOTAL_MALLOC_LEN, NULL, TEXT_BASE);
>> +}
>> +#endif
>
> This is global code, which is used not only on ARM systems. The
> changes break more or less all NAND-booting PowerPC board
> configurations.

Argh, you are right, thanks for finding this!

> I'm currently testing this change:
>
> -#if !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
> +#if defined(CONFIG_ARM) && !defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
>
>
> If this works, and you are OK with it, I will insert this into the
> commit when checking in.

I am fine with that, if it works ... but actually I am thinking
why this is not needed on PowerPC boards! If I don; t oversee
something, they jump in the nand_spl code to board_init_f() from
arch/powerpc/lib/board.c, and how fit this in the first nand
page?

Ahh! ... they(PowerPc boards) have their "own" board_init_f() in
nand_spl/board/* code for example like the mpc8313erdb ...
Hmm.. don;t know if this is possible for all PowerPc boards, but
I think, this should be also possible to move this board_init_f()
to a common place, like I did this for arm boards ... Ah, all
of this boards have board specific things to initialize in
their board_init_f() and then call relocate_code() ... Hmm...

So, in the end, I am fine with your suggested change!

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany