Skip to content

Commit d8c8a57

Browse files
committed
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>
1 parent 1b1f04d commit d8c8a57

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scripts/Makefile.dtbs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22

3+
all-dtb := $(dtb-y) $(dtb-)
4+
35
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
46
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
57

@@ -10,6 +12,13 @@ real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs)
1012
# Base DTB that overlay is applied onto
1113
base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs))
1214

15+
# Ensure that any .dtbo is applied to at least one base .dtb. Otherwise, it
16+
# does not get validated.
17+
applied-dtbo := $(filter %.dtbo, \
18+
$(call real-search, $(call multi-search, $(all-dtb), .dtb, -dtbs), .dtb, -dtbs))
19+
unapplied-dtbo := $(filter-out $(applied-dtbo),$(filter %.dtbo, $(dtb-y)))
20+
$(if $(unapplied-dtbo), $(warning .dtbo is not applied to any base: $(unapplied-dtbo)))
21+
1322
dtb-y := $(addprefix $(obj)/, $(dtb-y))
1423
multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))
1524
real-dtb-y := $(addprefix $(obj)/, $(real-dtb-y))

0 commit comments

Comments
 (0)