Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+9
+9
scripts/Makefile.dtbs
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 + all-dtb := $(dtb-y) $(dtb-) 4 + 3 5 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built 4 6 dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-) 5 7 ··· 11 9 real-dtb-y := $(call real-search, $(dtb-y), .dtb, -dtbs) 12 10 # Base DTB that overlay is applied onto 13 11 base-dtb-y := $(filter %.dtb, $(call real-search, $(multi-dtb-y), .dtb, -dtbs)) 12 + 13 + # Ensure that any .dtbo is applied to at least one base .dtb. Otherwise, it 14 + # does not get validated. 15 + applied-dtbo := $(filter %.dtbo, \ 16 + $(call real-search, $(call multi-search, $(all-dtb), .dtb, -dtbs), .dtb, -dtbs)) 17 + unapplied-dtbo := $(filter-out $(applied-dtbo),$(filter %.dtbo, $(dtb-y))) 18 + $(if $(unapplied-dtbo), $(warning .dtbo is not applied to any base: $(unapplied-dtbo))) 14 19 15 20 dtb-y := $(addprefix $(obj)/, $(dtb-y)) 16 21 multi-dtb-y := $(addprefix $(obj)/, $(multi-dtb-y))