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

Albert ARIBAUD
2010-11-02T09:11:32Z

Le 02/11/2010 09:57, Reinhard Meyer a ?crit :
> Dear Heiko Schocher,
>> 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.
>
> Worse: it would certainly crash since the original and relocated memory
> areas must not overlap - they sure would with even the slightest size change.

I'm not sure I get you there. If u-boot was linked for a given address
and happends to be loaded at that same address, then there is no need to
relocate, right?

> I would recommend that we add code to check for overlapping relocation into
> board.c and print a panic message if an overlap is detected.

I *think* overlap would be correctly handled if we modify the copy code
to copy from top to bottom, because we know that the destination is
higher than the source.

The only tricky case would be when the target address is right in the
middle of the source relocation code, because then the last iteratons of
the copy code would corrupt this code; that can be avoided by making
sure the SPL loads u-boot low enough in RAM.

> Best Regards,
> Reinhard

Amicalement,
--
Albert.