[PATCH v2] dts: Makefile: add support to build dedicated devicetree

Kory Maincent kory.maincent at bootlin.com
Tue Jul 20 11:02:31 CEST 2021


The devicetree described by the DEVICE_TREE variable was not build.
It was only use to test if it has been built then, happen the right
devicetree to U-boot binary.

This patch add support to build the devicetree describe by the
DEVICE_TREE variable.
This avoid adding the devicetree declaration to the related Makefile.

The use case is to ease the management of external devicetree when U-boot
is built by a build system.

Signed-off-by: Kory Maincent <kory.maincent at bootlin.com>
---

Change since v1:
Use the DEVICE_TREE U-boot environment variable to select the devicetree
build rather than appending the devicetree as an option of the make
command.

 dts/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/dts/Makefile b/dts/Makefile
index cb31113829..e3de63d847 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -10,9 +10,13 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+BUILD_DTBS := arch-dtbs
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 else
+ifneq ($(DEVICE_TREE),unset)
+BUILD_DTBS += target-dtb
+endif
 DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
 endif
 
@@ -30,7 +34,7 @@ endif
 
 targets += dt.dtb
 
-$(DTB): arch-dtbs
+$(DTB): $(BUILD_DTBS)
 	$(Q)test -e $@ || (						\
 	echo >&2;							\
 	echo >&2 "Device Tree Source ($@) is not correctly specified.";	\
@@ -39,10 +43,13 @@ $(DTB): arch-dtbs
 	echo >&2;							\
 	/bin/false)
 
-PHONY += arch-dtbs
+PHONY += arch-dtbs target-dtb
 arch-dtbs:
 	$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
 
+target-dtb:
+	$(Q)$(MAKE) $(build)=arch/$(ARCH)/dts $(DTB)
+
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
 # support "out-of-tree" build for dtb-spl
-- 
2.25.1



More information about the U-Boot mailing list