Commit 15d16d6d authored by Rob Herring's avatar Rob Herring

kbuild: Add generic rule to apply fdtoverlay

Add a generic rule to apply fdtoverlay in Makefile.lib, so every
platform doesn't need to carry the complex rule. This also automatically
adds "DTC_FLAGS_foo_base += -@" for all base files.

The platform's Makefile only needs to have this now:

 foo-dtbs := foo_base.dtb foo_overlay1.dtbo foo_overlay2.dtbo
 dtb-y := foo.dtb

We don't want to run schema checks on foo.dtb (as foo.dts doesn't exist)
and the Makefile is updated accordingly.
Acked-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Co-developed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: default avatarFrank Rowand <frank.rowand@sony.com>
Tested-by: default avatarFrank Rowand <frank.rowand@sony.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20920b0df6b067aca4040459a9677d7d1d6d766a.1615354376.git.viresh.kumar@linaro.org
parent 9ca29e41
...@@ -75,11 +75,24 @@ always-y += $(userprogs-always-y) $(userprogs-always-m) ...@@ -75,11 +75,24 @@ always-y += $(userprogs-always-y) $(userprogs-always-m)
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-) dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
# List all dtbs to be generated by fdtoverlay
overlay-y := $(foreach m,$(dtb-y), $(if $(strip $($(m:.dtb=-dtbs))),$(m),))
# Generate symbols for the base files so overlays can be applied to them.
$(foreach m,$(overlay-y), $(eval DTC_FLAGS_$(basename $(firstword $($(m:.dtb=-dtbs)))) += -@))
# Add base dtb and overlay dtbo
dtb-y += $(foreach m,$(overlay-y), $($(m:.dtb=-dtbs)))
always-y += $(dtb-y) always-y += $(dtb-y)
ifneq ($(CHECK_DTBS),) ifneq ($(CHECK_DTBS),)
always-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) # Don't run schema checks for dtbs created by fdtoverlay as they don't
always-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y)) # have corresponding dts files.
dt-yaml-y := $(filter-out $(overlay-y),$(dtb-y))
always-y += $(patsubst %.dtb,%.dt.yaml, $(dt-yaml-y))
always-y += $(patsubst %.dtbo,%.dt.yaml, $(dt-yaml-y))
endif endif
# Add subdir path # Add subdir path
...@@ -337,6 +350,15 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE ...@@ -337,6 +350,15 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
$(call if_changed_dep,dtc) $(call if_changed_dep,dtc)
overlay-y := $(addprefix $(obj)/, $(overlay-y))
quiet_cmd_fdtoverlay = DTOVL $@
cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
$(overlay-y): FORCE
$(call if_changed,fdtoverlay)
$(call multi_depend, $(overlay-y), .dtb, -dtbs)
DT_CHECKER ?= dt-validate DT_CHECKER ?= dt-validate
DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m) DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m)
DT_BINDING_DIR := Documentation/devicetree/bindings DT_BINDING_DIR := Documentation/devicetree/bindings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment