[PATCH 1/8] powerpc: mpc85xx: Fix CONFIG_OF_SEPARATE support
Pali Rohár
pali at kernel.org
Fri Apr 8 13:04:22 CEST 2022
On Tuesday 05 April 2022 15:12:30 Pali Rohár wrote:
> Currently CONFIG_OF_SEPARATE is completely broken and U-Boot for some
> mpc85xx board (e.g. P2020) has to be compiled with CONFIG_OF_EMBED.
> Otherwise it crashes during early init.
>
> When debug console is enabled and all debug logging options are turned on
> then U-Boot on P2020 with CONFIG_OF_SEPARATE prints following error:
>
> No valid device tree binary found at 110dc300
> initcall sequence 110d3560 failed at call 1109535c (err=-1)
> ### ERROR ### Please RESET the board ###
>
> Problem is with appended DTB. When CONFIG_SYS_MPC85XX_NO_RESETVEC is set
> U-Boot binary image without DTB ends immediately after the .u_boot_list
> section. At this position is defined _end symbol at which U-Boot expects
> start of the appended DTB.
>
> Problem is that after .u_boot_list section are in linker script defined
> another sections with 256 byte long padding which are completely empty.
> During conversion of U-Boot ELF binary to RAW binary u-boot-nodtb.bin,
> objcopy removes trailing zero padding and therefore DTB is appended at
> wrong position.
+Simon
I'm not sure if this is not rather generic bug in U-Boot build system.
objcopy really removes trailing zero padding from the end of file which
it creates. And if I'm looking into Makefiles correctly, it just do cat
of U-Boot binary and DTB files. So should not build system look into
source ELF binary where last section ends and adds necessary padding
between U-Boot binary and DTB file?
> Changing alignment from 256 bytes to 4 bytes fixes this issue. And appended
> DTB is finally at he correct position. With this fix U-Boot on P2020 with
> CONFIG_OF_SEPARATE option starts working again.
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
> ---
> arch/powerpc/cpu/mpc85xx/u-boot.lds | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/cpu/mpc85xx/u-boot.lds b/arch/powerpc/cpu/mpc85xx/u-boot.lds
> index 17a0e631ca3e..48509dbdae01 100644
> --- a/arch/powerpc/cpu/mpc85xx/u-boot.lds
> +++ b/arch/powerpc/cpu/mpc85xx/u-boot.lds
> @@ -75,11 +75,11 @@ SECTIONS
> __ex_table : { *(__ex_table) }
> __stop___ex_table = .;
>
> - . = ALIGN(256);
> + . = ALIGN(4);
> __init_begin = .;
> .text.init : { *(.text.init) }
> .data.init : { *(.data.init) }
> - . = ALIGN(256);
> + . = ALIGN(4);
> __init_end = .;
> _end = .;
>
> --
> 2.20.1
>
More information about the U-Boot
mailing list