Skip to contentSkip to conversation

Fixup relocation patch.]

PATCH New Joakim Tjernlund 2 participants 3 messages Feb 14, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixup relocation patch.]

Quoted 30 lines

From: Txema Lopez [mailto:tlopez at aotek.es]
Sent: 14 February 2007 09:01
To: Joakim Tjernlund
Cc: u-boot-users at lists.sourceforge.net
Subject: Re: [U-Boot-Users] [PATCH] Fixup relocation patch.]

Quoted 1 line · Joakim Tjernlund

I wonder, how far off is a fully relocatable u-boot? That

is, burn it anywhere

Quoted 6 lines

in flash and start it from there?

Jocke

Hi Jocke,
The patch was done precisely for it. You can copy a U-Boot image from an
address in flash to another and calculate the new pointers in the GOT an
FIXUP sections before do the copy.
But you need another change in U-Boot to turn it fully relocatable. U-Boot is hardly joined with the link address TEXT_BASE. You must replace it for a label in U-Boot and change the lines in the U-Boot code
where there is a direct or indirect reference (as CFG_MONITOR_BASE) to
TEXT_BASE.

Quoted 2 lines

Best regards,
Txema

Hi Txema

Can you give an example on how to change these references to TEXT_BASE/CFG_MONITOR_BASE?

Regards
Jocke

#1 lore raw

PATCH 1/1 Fixup relocation patch.]

Quoted 9 lines · Joakim Tjernlund

Hi Txema

Can you give an example on how to change these references to TEXT_BASE/CFG_MONITOR_BASE?

Regards
Jocke

Hi Jocke,

An example in C code in the board_init_f() function.

#ifdef CFG_BOOT_RELOCATABLE
len = (ulong)&_end - (ulong)&_start ;
#else
len = (ulong)&_end - CFG_MONITOR_BASE;
#endif

An example in assembler in the relocate_code function.

#ifdef CFG_BOOT_RELOCATABLE
lwz r4, GOT(_start)
#else
lis r4, CFG_MONITOR_BASE at h /* Source Address */ ori r4, r4, CFG_MONITOR_BASE at l
#endif

Anyway, if you are very interested in it I can made a patch for the 1.1.6 version (but merged with our custom board code) and send it to you out of the list to take a look.

Best regards,
Txema.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlopez.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20070214/fe0d3da5/attachment.vcf

#2 lore raw

PATCH 1/1 Fixup relocation patch.]

Quoted 21 lines · Txema Lopez
Quoted 9 lines · Joakim Tjernlund

Hi Txema

Can you give an example on how to change these references to TEXT_BASE/CFG_MONITOR_BASE?

Regards
Jocke

Hi Jocke,

An example in C code in the board_init_f() function.

#ifdef CFG_BOOT_RELOCATABLE
len = (ulong)&_end - (ulong)&_start ;
#else
len = (ulong)&_end - CFG_MONITOR_BASE;
#endif

Quoted 9 lines

An example in assembler in the relocate_code function.

#ifdef CFG_BOOT_RELOCATABLE
lwz r4, GOT(_start)
#else
lis r4, CFG_MONITOR_BASE at h /* Source Address */ ori r4, r4, CFG_MONITOR_BASE at l
#endif

Thanks, now I get it.

Quoted 4 lines

Anyway, if you are very interested in it I can made a patch for the 1.1.6 version (but merged with our custom board code) and send it to you out of the list to take a look.

Yes I am interested, but I am leaving for a 2 week vacation soon, so I will get back to you about this.

Thanks again
Jocke

Quoted 3 lines

Best regards,
Txema.