[U-Boot] Relocation

Hi,
Can anyone please explain how relocation address is calculated in uboot ?
Also, I want to know whether relocation will happen or not when uboot is running from RAM already? If yes, then can it be disabled ?
Thank you,
-- View this message in context: http://u-boot.10912.n7.nabble.com/Relocation-tp175974.html Sent from the U-Boot mailing list archive at Nabble.com.

Hi mahsmak,
On Fri, 14 Mar 2014 06:38:34 -0700 (PDT), mahsmak kshamim.pk@gmail.com wrote:
Hi,
Can anyone please explain how relocation address is calculated in uboot ?
U-Boot tries to relocate itself as high in RAM as possible so that the lower area is available to e.g. the Linux kernel it will chainload.
Therefore, the usual process is that U-Boot first reserves whatever amount of memory it needs at end of RAM, then relocates itself just below that.
Also, I want to know whether relocation will happen or not when uboot is running from RAM already? If yes, then can it be disabled ?
Relocation will always happen, and there is no provision for avoiding it.
Thank you,
Amicalement,

Hi, Albert:
Relocation will always happen, and there is no provision for avoiding it.
I have ever tried to del these code in crt0.S : ldr sp, [r8, #GD_START_ADDR_SP] /* r8 = gd->start_addr_sp */ bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ ldr r8, [r8, #GD_BD] /* r8 = gd->bd */ sub r8, r8, #GD_SIZE /* new GD is below bd */
/// tricky code : insure to return here after running relocate_code. adr lr, here ldr r0, [r8, #GD_RELOC_OFF] /* lr = gd->start_addr_sp */ add lr, lr, r0 ldr r0, [r8, #GD_RELOCADDR] /* r0 = gd->relocaddr */ /// start.S implement this function. b relocate_code
Then no relocation, it seemed OK.
Best wishes,

Dear TigerLiu@via-alliance.com,
In message FE7ADED5C2218B4786C09CD97DC4C49FE20D1B@exchbj02.viatech.com.bj you wrote:
Relocation will always happen, and there is no provision for avoiding it.
...
Then no relocation, it seemed OK.
You used the correct phrase: it seemed. Except that you broke a number of really important things. If you do not understand what rlocation is needed for, then please gop back and read it in the archives. This has been discussed many times before.
Best regards,
Wolfgang Denk

Hi, Denk:
You used the correct phrase: it seemed. Except that you broke a number of really important things. If you do not understand what rlocation is needed for, then please gop back and read it in the archives. This has been discussed many times before.
For example: Most ARM SOC platform has BL1 code(Boot Stage 1) before U-boot. So, usually BL1 code could load U-boot.bin to DRAM's dedicated location. So, U-boot need not be relocated again in this case.
Best wishes,

Dear TigerLiu@via-alliance.com,
In message FE7ADED5C2218B4786C09CD97DC4C49FE20DA6@exchbj02.viatech.com.bj you wrote:
You used the correct phrase: it seemed. Except that you broke a number of really important things. If you do not understand what rlocation is needed for, then please gop back and read it in the archives. This has been discussed many times before.
For example: Most ARM SOC platform has BL1 code(Boot Stage 1) before U-boot. So, usually BL1 code could load U-boot.bin to DRAM's dedicated location.
No, it cannot, as the target address depends on a lot of things, including (depending on your config options) contents of some environment variables which may even change from one boot to the next, so the target address is not know in advance.
So, U-boot need not be relocated again in this case.
Yes, it does. All this has been explained again and again in the past, and I really would like to ask you to read this in the archives instead of trying to reanimate this dead horse for the N+1th time.
Thanks.
Best regards,
Wolfgang Denk
participants (4)
-
Albert ARIBAUD
-
mahsmak
-
TigerLiu@via-alliance.com
-
Wolfgang Denk