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

kbuild: Optionally enable schema checks for %.dtb targets

While not documented, schema checks for single dtb targets mostly work
already by setting 'CHECK_DTBS=1'. However, the dependencies are not
handled and it only works if 'make dt_bindings_check' was run first and
generated processed-schema.json. In addition, changing a binding file
doesn't cause the schema to be rebuilt and dtb to be revalidated.

Making this work turns out to be simple. Whenever CHECK_DTBS is set,
make 'dt_binding_check' a 'dtbs_prepare' dependency.

I reimplemented here what Masahiro had originally come up with a while
back.

Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Tested-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20221220013233.2890335-1-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>

+8 -1
+8 -1
Makefile
··· 1481 1481 1482 1482 ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),) 1483 1483 export CHECK_DTBS=y 1484 - dtbs: dt_binding_check 1484 + endif 1485 + 1486 + ifneq ($(CHECK_DTBS),) 1487 + dtbs_prepare: dt_binding_check 1485 1488 endif 1486 1489 1487 1490 dtbs_check: dtbs ··· 1782 1779 @echo ' 3: more obscure warnings, can most likely be ignored' 1783 1780 @echo ' e: warnings are being treated as errors' 1784 1781 @echo ' Multiple levels can be combined with W=12 or W=123' 1782 + @$(if $(dtstree), \ 1783 + echo ' make CHECK_DTBS=1 [targets] Check all generated dtb files against schema'; \ 1784 + echo ' This can be applied both to "dtbs" and to individual "foo.dtb" targets' ; \ 1785 + ) 1785 1786 @echo '' 1786 1787 @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 1787 1788 @echo 'For further info see the ./README file'