[PATCH 2/3] dts: Add ability to build DTOs only from arch/$(ARCH)/dts

Marek Vasut marex at denx.de
Fri Sep 27 23:48:28 CEST 2024


Currently the enablement of OF_UPSTREAM results on the build system
searching for DTs only in dts/upstream/ . There are platforms which
use U-Boot specific DTBOs applied on top of U-Boot control DT during
SPL stage, and source DTs for these are located in arch/$(ARCH)/dtb.

Add dedicated 'dtbos' target which builds only .dtbos and not .dtbs and
in case OF_UPSTREAM is enabled, build this target for arch/$(ARCH)/dtb
to generate local U-Boot specific DTBOs.

Adjust top level Makefile so binman would search for .dtb and .dtbo in
both OF_UPSTREAM specific paths and arch/$(ARCH)/dtb for the .dtbo case.

Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: "NXP i.MX U-Boot Team" <uboot-imx at nxp.com>
Cc: Caleb Connolly <caleb.connolly at linaro.org>
Cc: Christoph Niedermaier <cniedermaier at dh-electronics.com>
Cc: Fabio Estevam <festevam at gmail.com>
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Cc: Jonas Karlman <jonas at kwiboo.se>
Cc: Lothar Rubusch <l.rubusch at gmail.com>
Cc: Michal Simek <michal.simek at amd.com>
Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
Cc: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
Cc: Simon Glass <sjg at chromium.org>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Sumit Garg <sumit.garg at linaro.org>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at dh-electronics.com
Cc: u-boot at lists.denx.de
---
 Makefile             |  5 ++++-
 dts/Makefile         | 11 +++++++++--
 scripts/Makefile.dts |  5 ++++-
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 525576f987d..fba8e48681e 100644
--- a/Makefile
+++ b/Makefile
@@ -1194,6 +1194,8 @@ else
 dt_dir := arch/$(ARCH)/dts
 endif
 
+local_dto_dir := arch/$(ARCH)/dts
+
 ifeq ($(CONFIG_MULTI_DTB_FIT),y)
 
 ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y)
@@ -1377,7 +1379,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
 		build -u -d u-boot.dtb -O . -m \
 		--allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
 		-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
-		-I $(dt_dir) -a of-list=$(CONFIG_OF_LIST) \
+		-I $(dt_dir) -I $(local_dto_dir) \
+		-a of-list=$(CONFIG_OF_LIST) \
 		$(foreach f,$(BINMAN_INDIRS),-I $(f)) \
 		-a atf-bl31-path=${BL31} \
 		-a tee-os-path=${TEE} \
diff --git a/dts/Makefile b/dts/Makefile
index d6c2c9daf31..f872a867667 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -11,12 +11,16 @@ DEVICE_TREE := unset
 endif
 
 ifeq ($(CONFIG_OF_UPSTREAM),y)
+local_dtbos := local-dtbos
+local_dtbo_dir := arch/$(ARCH)/dts
 ifeq ($(CONFIG_ARM64),y)
 dt_dir := dts/upstream/src/arm64
 else
 dt_dir := dts/upstream/src/$(ARCH)
 endif
 else
+local_dtbos :=
+local_dtbo_dir :=
 dt_dir := arch/$(ARCH)/dts
 endif
 
@@ -40,7 +44,7 @@ endif
 
 targets += dt.dtb
 
-$(DTB): arch-dtbs
+$(DTB): arch-dtbs $(local_dtbos)
 	$(Q)test -e $@ || (						\
 	echo >&2;							\
 	echo >&2 "Device Tree Source ($@) is not correctly specified.";	\
@@ -49,10 +53,13 @@ $(DTB): arch-dtbs
 	echo >&2;							\
 	/bin/false)
 
-PHONY += arch-dtbs
+PHONY += arch-dtbs local-dtbos
 arch-dtbs:
 	$(Q)$(MAKE) $(build)=$(dt_dir) dtbs
 
+local-dtbos:
+	$(Q)$(MAKE) $(build)=$(local_dtbo_dir) dtbos
+
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
 # support "out-of-tree" build for dtb-spl
diff --git a/scripts/Makefile.dts b/scripts/Makefile.dts
index 1fe142f2bbf..f4d3a37010a 100644
--- a/scripts/Makefile.dts
+++ b/scripts/Makefile.dts
@@ -17,8 +17,11 @@ endif
 
 targets += $(dtb-y)
 
-PHONY += dtbs
+PHONY += dtbs dtbos
 dtbs: $(addprefix $(obj)/, $(dtb-y))
 	@:
 
+dtbos: $(addprefix $(obj)/, $(filter-out %.dtb,$(dtb-y)))
+	@:
+
 clean-files := *.dtb *.dtbo */*.dtb */*.dtbo *_HS
-- 
2.45.2



More information about the U-Boot mailing list