Skip to contentSkip to conversation

kbuild: Support directory targets for building DTBs

RFC PATCH Superseded Rob Herring (Arm) 1 participant 1 message Nov 13, 2025

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Rob Herring (Arm)

author maintainer
#0 lore raw

RFC PATCH 1/1 kbuild: Support directory targets for building DTBs

It is useful to be able to build all the DTBs for a vendor. One can list all the .dts files in a directory and convert those to %.dtb targets, but that doesn't work for base+overlay DTB targets.

Adding the dts subdirectory is straight-forward, but building the DTBs should only happen for certain targets (dtbs, dtbs_check, %.dtb, %.dtbo, and the directory target(s)).

The 'scripts_dtc' rule doesn't really depend on 'dt_binding_schemas', but the directory target only depends on 'scripts' which depends on 'scripts_dtc'.

---
RFC because only arm64 converted ATM.

I don't really like looking at MAKECMDGOALS, but that's the only way I could come up with that works. Maybe someone knows a better way.

---
 Makefile              | 2 +-
 arch/arm64/Kbuild     | 2 ++
 scripts/Makefile.dtbs | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)
Makefile +1 -1
index 17cfa11ca716..85018d461575 100644
@@ -1494,7 +1494,7 @@ export CHECK_DTBS=y
 endif
 
 ifneq ($(CHECK_DTBS),)
-dtbs_prepare: dt_binding_schemas
+scripts_dtc: dt_binding_schemas
 endif
 
 dtbs_check: dtbs
arch/arm64/Kbuild +2 -0
index 5bfbf7d79c99..9e9820af48c9 100644
@@ -5,5 +5,7 @@ obj-$(CONFIG_XEN)	+= xen/
 obj-$(subst m,y,$(CONFIG_HYPERV))	+= hyperv/
 obj-$(CONFIG_CRYPTO)	+= crypto/
 
+subdir-y += boot/dts
+
 # for cleaning
 subdir- += boot
scripts/Makefile.dtbs +3 -0
index 2d321b813600..4d0d164df275 100644
@@ -14,7 +14,10 @@ dtb-y           := $(addprefix $(obj)/, $(dtb-y))
 multi-dtb-y     := $(addprefix $(obj)/, $(multi-dtb-y))
 real-dtb-y      := $(addprefix $(obj)/, $(real-dtb-y))
 
+ifneq ($(findstring /dts/,$(MAKECMDGOALS))$(findstring dtb,$(MAKECMDGOALS)),)
 always-y        += $(dtb-y)
+endif
+
 targets         += $(real-dtb-y)
 
 # dtbs-list
Signature · 1 line
2.51.0