board_f: fix calculation of reloc_off
PATCH 1/1 board_f: fix calculation of reloc_off
relocate_code() calculates the relocation offset wrt. the symbol __image_copy_start which happens to have the same value as CONFIG_TEXT_BASE on most systems.
When creating an i.MX boot image with an integrated IVT it is convenient to have CONFIG_TEXT_BASE point to the start of the IVT that is prepended to the actual code. Thus CONFIG_TEXT_BASE will differ from __image_copy_start, while the calculation 'gd->relocaddr - __image_copy_start' still gives the right relocation offset.
--- common/board_f.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
common/board_f.c +5 -2
@@ -610,13 +610,16 @@ static int setup_reloc(void) }#ifdef CONFIG_SYS_TEXT_BASE - gd->reloc_off = gd->relocaddr -CONFIG_SYS_TEXT_BASE ; -#ifdef CONFIG_M68K +#ifdef ARM + gd->reloc_off = gd->relocaddr - (unsigned long )__image_copy_start; +#elif defined(CONFIG_M68K )/* * On all ColdFire arch cpu, monitor code starts always * just after the default vector table location, so at 0x400 */ gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE +0x400 ); +#else + gd->reloc_off = gd->relocaddr -CONFIG_SYS_TEXT_BASE ;#endif #endif memcpy (gd->new_gd, (char *)gd,sizeof (gd_t));
Signature · 1 line
2.1.4
Quoted 11 lines · Lothar Waßmann
relocate_code()calculates the relocation offset wrt. the symbol__image_copy_startwhich happens to have the same value asCONFIG_TEXT_BASEon most systems.
When creating an i.MX boot image with an integrated IVT it is convenient to haveCONFIG_TEXT_BASEpoint to the start of the IVT that is prepended to the actual code. ThusCONFIG_TEXT_BASEwill differ from__image_copy_start, while the calculation 'gd->relocaddr-__image_copy_start' still gives the right relocation offset.Signed-off-by Lothar Waßmann <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170612/3426f2a5/attachment.sig>