CONFIG_SPL_SKIP_RELOCATE in non-SPL build
Tom Rini
trini at konsulko.com
Thu Oct 19 22:29:00 CEST 2023
On Thu, Oct 19, 2023 at 03:30:25PM +0200, Martin Fäcknitz wrote:
> 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.
Thanks for the report. Can you submit a full patch to correct this?
Unfortunately there's few people available to test those platforms which
is why they're in the state they are in.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231019/cd35185e/attachment.sig>
More information about the U-Boot
mailing list