[PATCH] spl: Align device tree blob address at 8-byte boundary

Reuben Dowle reuben.dowle at 4rf.com
Mon Jul 12 07:21:31 CEST 2021


I submitted an almost identical patch. See https://github.com/u-boot/u-boot/commit/eb39d8ba5f0d1468b01b89a2a464d18612d3ea76

This patch eventually had to be reverted (https://github.com/u-boot/u-boot/commit/5675ed7cb645f5ec13958726992daeeed16fd114), because it was causing issues on some platforms that had FIT on 32 bit boundary. However I continue to use it in production code, as without it the boot on my platform aborts.

I don't have time to investigate why this was happening, but you need to check this code won't just cause exactly the same faults.

> -----Original Message-----
> From: U-Boot <u-boot-bounces at lists.denx.de> On Behalf Of Bin Meng
> Sent: Monday, 12 July 2021 3:53 pm
> To: Tom Rini <trini at konsulko.com>; Simon Glass <sjg at chromium.org>; u-
> boot at lists.denx.de
> Cc: Bin Meng <bmeng.cn at gmail.com>
> Subject: [PATCH] spl: Align device tree blob address at 8-byte boundary
> 
> Since libfdt v1.6.1, a new requirement on the device tree address via:
> 
>   commit 5e735860c478 ("libfdt: Check for 8-byte address alignment in
> fdt_ro_probe_()")
> 
> must be met that the device tree must be loaded in to memory at an 8-byte
> aligned address.
> 
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
> 
>  common/spl/spl_fit.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index
> f41abca0cc..9baf6aca9f 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -374,6 +374,12 @@ static int spl_fit_append_fdt(struct spl_image_info
> *spl_image,
>  	 */
>  	image_info.load_addr = spl_image->load_addr + spl_image->size;
> 
> +	/*
> +	 * Since libfdt v1.6.1, the device tree must be loaded in to memory
> +	 * at an 8-byte aligned address.
> +	 */
> +	image_info.load_addr = roundup(image_info.load_addr, 8);
> +
>  	/* Figure out which device tree the board wants to use */
>  	node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
>  	if (node < 0) {
> --
> 2.25.1



More information about the U-Boot mailing list