[PATCH 4/4] kbuild: arm: Fix duplicate builds of dtbs

Andrew F. Davis afd at ti.com
Fri May 8 17:40:37 CEST 2020


On 5/4/20 8:38 AM, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka at siemens.com>
> 
> Build the secured board dtbs (.dtb_HS) as part of the regular dtb build
> on CONFIG_TI_SECURE_DEVICE targets. This avoids rebuilding them,
> possibly overwriting artifacts that are in use, as it is done so far.
> 
> In the same run, fix needless rebuilding of the secured spl dtb.
> 
> Fixes: 508369672ca3 ("arm: mach-k3: Add secure device build support")
> CC: Andrew F. Davis <afd at ti.com>
> Signed-off-by: Jan Kiszka <jan.kiszka at siemens.com>
> ---
>  arch/arm/dts/Makefile             |  6 ++++--
>  arch/arm/mach-k3/config_secure.mk | 19 ++++++++++++++-----
>  2 files changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 2c123bd6da..b68e9c0726 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -1,5 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0+
> 
> +include $(srctree)/arch/arm/mach-k3/config_secure.mk
> +


This is hacky, we should not in the top level dts makefile have a
dependency on a specific platform configuration file.

What about mach-omap/config_secure.mk, etc..

The negative of building dtbs twice for HS is very minor compared to the
extra complexity this patch adds. It will be much more difficult to
clean this up later.

Andrew


>  dtb-$(CONFIG_TARGET_SMARTWEB) += at91sam9260-smartweb.dtb
>  dtb-$(CONFIG_TARGET_TAURUS) += at91sam9g20-taurus.dtb
>  dtb-$(CONFIG_TARGET_CORVUS) += at91sam9g45-corvus.dtb
> @@ -927,13 +929,13 @@ dtb-$(CONFIG_TARGET_DURIAN) += phytium-durian.dtb
> 
>  dtb-$(CONFIG_TARGET_PRESIDIO_ASIC) += ca-presidio-engboard.dtb
> 
> -targets += $(dtb-y)
> +targets += $(dtb-y) $(TI_SECURE_DTBS)
> 
>  # Add any required device tree compiler flags here
>  DTC_FLAGS +=
> 
>  PHONY += dtbs
> -dtbs: $(addprefix $(obj)/, $(dtb-y))
> +dtbs: $(addprefix $(obj)/, $(dtb-y) $(TI_SECURE_DTBS))
>  	@:
> 
>  clean-files := *.dtb *.dtbo *_HS
> diff --git a/arch/arm/mach-k3/config_secure.mk b/arch/arm/mach-k3/config_secure.mk
> index 6d63c57665..d9141e10a0 100644
> --- a/arch/arm/mach-k3/config_secure.mk
> +++ b/arch/arm/mach-k3/config_secure.mk
> @@ -26,7 +26,12 @@ endif
>  $(obj)/u-boot-spl-nodtb.bin_HS: $(obj)/u-boot-spl-nodtb.bin FORCE
>  	$(call if_changed,k3secureimg)
> 
> -tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(patsubst %,$(obj)/dts/%.dtb_HS,$(subst ",,$(CONFIG_SPL_OF_LIST))) $(SPL_ITS) FORCE
> +SPL_OF_LIST_TARGETS = $(patsubst %,dts/%.dtb,$(subst ",,$(CONFIG_SPL_OF_LIST)))
> +SPL_OF_LIST_TARGETS_HS = $(addsuffix _HS,$(SPL_OF_LIST_TARGETS))
> +
> +targets += $(SPL_OF_LIST_TARGETS) $(SPL_OF_LIST_TARGETS_HS)
> +
> +tispl.bin_HS: $(obj)/u-boot-spl-nodtb.bin_HS $(addprefix $(obj)/,$(SPL_OF_LIST_TARGETS_HS)) $(SPL_ITS) FORCE
>  	$(call if_changed,mkfitimage)
> 
>  MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
> @@ -34,11 +39,15 @@ MKIMAGEFLAGS_u-boot.img_HS = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
>  	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
>  	$(patsubst %,-b arch/$(ARCH)/dts/%.dtb_HS,$(subst ",,$(CONFIG_OF_LIST)))
> 
> -OF_LIST_TARGETS = $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST)))
> -$(OF_LIST_TARGETS): dtbs
> -
>  u-boot-nodtb.bin_HS: u-boot-nodtb.bin FORCE
>  	$(call if_changed,k3secureimg)
> 
> -u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img $(patsubst %.dtb,%.dtb_HS,$(OF_LIST_TARGETS)) FORCE
> +u-boot.img_HS: u-boot-nodtb.bin_HS u-boot.img dtbs FORCE
>  	$(call if_changed,mkimage)
> +
> +# Used when included by arch-dts makefile
> +-include include/config/auto.conf
> +
> +ifeq ($(CONFIG_TI_SECURE_DEVICE),y)
> +TI_SECURE_DTBS = $(addsuffix _HS, $(dtb-y))
> +endif
> --
> 2.26.1
> 


More information about the U-Boot mailing list