CONFIG_SPL_SKIP_RELOCATE in non-SPL build
Martin Fäcknitz
faecknitz at hotsplots.de
Thu Oct 19 15:30:25 CEST 2023
Hello,
The patch
Convert CONFIG_SPL_INIT_MINIMAL et al to Kconfig
(b35316fb67cb7aeaf022032ce078135251372f39)
changes the behaviour for non-SPL builds when relocating code. The patch
sets the CONFIG_SPL_SKIP_RELOCATE option in a few freescale boards, e.g.
T1024RDB_SDCARD_defconfig.
Before, CONFIG_SPL_SKIP_RELOCATE was only defined when building the SPL image:
#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SPL_SKIP_RELOCATE
#define CONFIG_SPL_COMMON_INIT_DDR
#define CONFIG_SYS_CCSR_DO_NOT_RELOCATE
#endif
Now, the relocate_code function in arch/powerpc/cpu/mpc85xx/start.S does no
relocation because CONFIG_SPL_SKIP_RELOCATE is always defined:
relocate_code:
...
#ifndef CONFIG_SPL_SKIP_RELOCATE
... relocate code from SYS_MONITOR_BASE to gd->relocaddr ..
#endif
When jump_to_copy is called (common/board_f.c), the
relocate_code(gd->start_addr_sp, gd->new_gd, gd->relocaddr)
would not relocate u-boot (located at SYS_MONITOR_BASE) to gd->relocaddr.
For example, SYS_MONITOR_BASE is 0x3000.0000 and gd->relocaddr is 0x7bf7.0000:
Relocation Offset is: 4bf70000
Relocating to 7bf70000, new gd at 7bb6de50, sp at 7bb6b540
Any access to memory 7bf70000+ is invalid, because no relocation was done.
When patching
-#ifndef CONFIG_SPL_SKIP_RELOCATE
+#if !defined(CONFIG_SPL_SKIP_RELOCATE) || !defined(CONFIG_SPL_BUILD)
relocation is done in non-SPL builds and booting works.
Testet on T1042E board using U-Boot 2023.10.02-01420.
Best regards
Martin
--
Martin Fäcknitz
hotsplots GmbH
Rotherstr. 22
10245 Berlin
Fon: +49 (0)30 29 77 348-0
Fax: +49 (0)30 29 77 348-99
E-Mail: faecknitz at hotsplots.de
Amtsgericht Charlottenburg HRB 93460B
Geschäftsführung: Sascha Schaub, Dr. Ulrich Meier, Dr. Jörg Ontrup
More information about the U-Boot
mailing list