From c59773d204cc02cc97b4b8dc4cf87a595204cc9d Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Thu, 11 Mar 2021 16:36:40 -0700 Subject: kbuild: Enable DT undocumented compatible checks dt-validate has an option to warn on any compatible strings which don't match any schema. The option has recently been improved to fix false positives, so let's enable the option. This is useful for tracking compatibles which are undocumented or not yet converted to DT schema. Previously, the only check of undocumented compatible strings has been an imperfect checkpatch.pl check. The option is enabled by default for 'dtbs_check'. This will add more warnings, but some platforms are down to only a handful of these warnings (good job!). There's about 100 cases in the binding examples, so the option is disabled until these are fixed. In the meantime, they can be checked with: make DT_CHECKER_FLAGS=-m dt_binding_check Cc: Maxime Ripard Cc: Masahiro Yamada Cc: Michal Marek Cc: linux-kbuild@vger.kernel.org Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20210311233640.1581526-2-robh@kernel.org --- scripts/Makefile.lib | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/Makefile.lib') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index eee59184de64..34e5fefa8d92 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -339,12 +339,13 @@ $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE $(call if_changed_dep,dtc) DT_CHECKER ?= dt-validate +DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m) DT_BINDING_DIR := Documentation/devicetree/bindings # DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile DT_TMP_SCHEMA ?= $(objtree)/$(DT_BINDING_DIR)/processed-schema.json quiet_cmd_dtb_check = CHECK $@ - cmd_dtb_check = $(DT_CHECKER) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ + cmd_dtb_check = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ define rule_dtc $(call cmd_and_fixdep,dtc) -- cgit v1.2.3 From 9ca29e41508e97bec2f45c7f9b79108107d6b3d5 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Wed, 10 Mar 2021 11:05:29 +0530 Subject: kbuild: Simplify builds with CONFIG_OF_ALL_DTBS We update 'always-y' based on CONFIG_OF_ALL_DTBS three times. It would be far more straight forward if we rather update dtb-y to include all .dtb files if CONFIG_OF_ALL_DTBS is enabled. Acked-by: Masahiro Yamada Signed-off-by: Viresh Kumar Reviewed-by: Frank Rowand Tested-by: Frank Rowand Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/7fe7e5ef6ed75450ddf6c224b8adb53059e504e2.1615354376.git.viresh.kumar@linaro.org --- scripts/Makefile.lib | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts/Makefile.lib') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 34e5fefa8d92..441a224689f9 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -73,14 +73,13 @@ always-y += $(userprogs-always-y) $(userprogs-always-m) # DTB # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built +dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-) + always-y += $(dtb-y) -always-$(CONFIG_OF_ALL_DTBS) += $(dtb-) ifneq ($(CHECK_DTBS),) always-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) always-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y)) -always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) -always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-)) endif # Add subdir path -- cgit v1.2.3 From 15d16d6dadf6947ac7f9a686c615995c5a426ce2 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 10 Mar 2021 11:05:30 +0530 Subject: 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: Masahiro Yamada Signed-off-by: Rob Herring Co-developed-by: Viresh Kumar Signed-off-by: Viresh Kumar Reviewed-by: Frank Rowand Tested-by: Frank Rowand Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20920b0df6b067aca4040459a9677d7d1d6d766a.1615354376.git.viresh.kumar@linaro.org --- scripts/Makefile.lib | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'scripts/Makefile.lib') diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 441a224689f9..ad6938468c11 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -75,11 +75,24 @@ always-y += $(userprogs-always-y) $(userprogs-always-m) # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built 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) ifneq ($(CHECK_DTBS),) -always-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) -always-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y)) +# Don't run schema checks for dtbs created by fdtoverlay as they don't +# 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 # Add subdir path @@ -337,6 +350,15 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE $(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE $(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_FLAGS ?= $(if $(DT_SCHEMA_FILES),,-m) DT_BINDING_DIR := Documentation/devicetree/bindings -- cgit v1.2.3