[PATCH 07/10] Makefile: Align fit-dtb.blob and u-boot.itb by 64bits for 64bit systems

Andre Przywara andre.przywara at arm.com
Thu Aug 19 17:56:01 CEST 2021


On 8/19/21 12:19 PM, Michal Simek wrote:

Hi,

> Enabling MULTI_DTB_FIT and DTB_RESELECT can end up with multi DTBs in FIT
> image placed and aligned only by 32bits (4bytes). For 64bit systems there
> is 64bit (8bytes) alignment required. That's why make sure that
> fit-dtb.blob and u-boot.itb as our primary target images for Xilinx ZynqMP
> are all 64bit aligned. The patch is using CONFIG_PHYS_64BIT macro to
> identify 64bit systems (including 32bit systems with PAE).
> 
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
> 
>   Makefile | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 269e353a28ad..1bbe95595efe 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1169,6 +1169,10 @@ MKIMAGEFLAGS_fit-dtb.blob = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
>   	-a 0 -e 0 -E \
>   	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d /dev/null
>   
> +ifeq ($(CONFIG_PHYS_64BIT),y)

Why is this restricted to 64-bit "systems"? The DT spec[1] clearly 
states that some DT parts (/memreserved/ block, for instance), must be 
64-bit aligned, which means the whole blobs needs to be 64-bit aligned. 
Granted this probably does not cause real issues on 32-bit systems, but 
is violating the spec anyway.
So I'd say we add the alignment requirement unconditionally.

Cheers,
Andre

[1] 
https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf

> +MKIMAGEFLAGS_fit-dtb.blob += -B 0x8
> +endif
> +
>   ifneq ($(EXT_DTB),)
>   u-boot-fit-dtb.bin: u-boot-nodtb.bin $(EXT_DTB)
>   		$(call if_changed,cat)
> @@ -1431,6 +1435,9 @@ MKIMAGEFLAGS_u-boot.itb =
>   else
>   MKIMAGEFLAGS_u-boot.itb = -E
>   endif
> +ifeq ($(CONFIG_PHYS_64BIT),y)
> +MKIMAGEFLAGS_u-boot.itb += -B 0x8
> +endif
>   
>   ifdef U_BOOT_ITS
>   u-boot.itb: u-boot-nodtb.bin \
> 



More information about the U-Boot mailing list