summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Herring (Arm) <robh@kernel.org>2025-11-14 16:25:37 -0600
committerRob Herring (Arm) <robh@kernel.org>2025-11-17 11:27:52 -0600
commitd8c8a575f5aa7afc7cc7718b779c29ae5f7abc58 (patch)
treeb7e6d7ed211c7a8b4aa56d6fac3c5f0f79d9b336 /scripts
parent1b1f04d8271e7ba70fbbb13754b1e869f70aa785 (diff)
kbuild: Ensure .dtbo targets are applied to a base .dtb
It is a requirement that DT overlays in the kernel are applied at build time to a base DTB in order to validate they can be applied and to validate them against the DT schemas. DT overlays on their own may be incomplete and can't be validated. Add a kbuild check so this doesn't have to be checked and fixed periodically. Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.dtbs9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
index 2d321b813600..e092b460d5a1 100644
--- a/scripts/Makefile.dtbs
+++ b/scripts/Makefile.dtbs
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
+all-dtb := $(dtb-y) $(dtb-)
+
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
@@ -10,6 +12,13 @@ real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
# Base DTB that overlay is applied onto
base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
+# Ensure that any .dtbo is applied to at least one base .dtb. Otherwise, it
+# does not get validated.
+applied-dtbo := $(filter %.dtbo, \
+ $(call real-search, $(call multi-search, $(all-dtb), .dtb, -dtbs), .dtb, -dtbs))
+unapplied-dtbo := $(filter-out $(applied-dtbo),$(filter %.dtbo, $(dtb-y)))
+$(if $(unapplied-dtbo), $(warning .dtbo is not applied to any base: $(unapplied-dtbo)))
+
dtb-y := $(addprefix $(obj)/, $(dtb-y))
multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))