From 4be3fe9d80a6cb26d551ea43e8a6211945bc8a06 Mon Sep 17 00:00:00 2001 From: Sumit Garg Date: Thu, 22 Feb 2024 15:05:58 +0530 Subject: Makefile: Add support for DT bindings schema checks This adds the build infrastructure for checking DT binding schema documents and validating dtb files using the binding schema. Here we use devicetree-rebasing subtree to provide the DT bindings. Along with that adapt dts/upstream/Bindings/Makefile to align with old U-Boot Kbuild infrastructure. Dependency: ----------- The DT schema project must be installed in order to validate the DT schema binding documents and validate DTS files using the DT schema. The DT schema project can be installed with pip:: pip3 install dtschema Note that 'dtschema' installation requires 'swig' and Python development files installed first. On Debian/Ubuntu systems:: apt install swig python3-dev Testing: -------- Build dts files and check using DT binding schema: $ make dtbs_check Optionally, DT_SCHEMA_FILES can be passed in with a schema file(s) to use for validation. This makes it easier to find and fix errors generated by a specific schema. Note, at this point dtbs_check is an optional build target as there are many warnings generated due to custom DT properties used by many platforms in u-boot. It is expected with these checks that compliance with DT bindings to take place. Once that's done it can be added to CI builds to remain compliant with DT bindings. Reviewed-by: Simon Glass Tested-by: Simon Glass Signed-off-by: Sumit Garg --- dts/upstream/Bindings/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dts/upstream') diff --git a/dts/upstream/Bindings/Makefile b/dts/upstream/Bindings/Makefile index 3e886194b04..e799963a599 100644 --- a/dts/upstream/Bindings/Makefile +++ b/dts/upstream/Bindings/Makefile @@ -47,9 +47,9 @@ quiet_cmd_mk_schema = SCHEMA $@ rm -f $$f define rule_chkdt - $(if $(DT_SCHEMA_LINT),$(call cmd,yamllint),) - $(call cmd,chk_bindings) - $(call cmd,mk_schema) + $(if $(DT_SCHEMA_LINT),$(call echo-cmd,yamllint) $(cmd_yamllint),); \ + $(call echo-cmd,chk_bindings) $(cmd_chk_bindings); \ + $(call echo-cmd,mk_schema) $(cmd_mk_schema) endef DT_DOCS = $(patsubst $(srctree)/%,%,$(shell $(find_all_cmd))) -- cgit v1.2.3