diff mbox series

[1/1] kbuild: Add DT schema check also when applying DT overlays

Message ID 20240225151209.343160-1-alexander.stein@mailbox.org (mailing list archive)
State New, archived
Headers show
Series [1/1] kbuild: Add DT schema check also when applying DT overlays | expand

Commit Message

Alexander Stein Feb. 25, 2024, 3:12 p.m. UTC
Add a similar mechanism as for regular DT files to call the DT checker
after applying DT overlays to base DT files.

Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
---
I'm unsure if this is the "right" way, or if the multi-dtb-y lines
should be moved. But checking for schemas in DT overlays is a nice thing.

 scripts/Makefile.lib | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Masahiro Yamada Feb. 26, 2024, 7:02 a.m. UTC | #1
+ Rob Herring, DT List


On Mon, Feb 26, 2024 at 12:12 AM Alexander Stein
<alexander.stein@mailbox.org> wrote:
>
> Add a similar mechanism as for regular DT files to call the DT checker
> after applying DT overlays to base DT files.
>
> Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
> ---
> I'm unsure if this is the "right" way, or if the multi-dtb-y lines
> should be moved. But checking for schemas in DT overlays is a nice thing.



There is no need to move the multi-dtb-y line.




>  scripts/Makefile.lib | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 038a12e15586..964892b18f95 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -406,10 +406,6 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
>  quiet_cmd_fdtoverlay = DTOVL   $@
>        cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
>
> -$(multi-dtb-y): FORCE
> -       $(call if_changed,fdtoverlay)
> -$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
> -
>  ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
>  DT_CHECKER ?= dt-validate
>  DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
> @@ -418,9 +414,13 @@ DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
>
>  quiet_cmd_dtb =        DTC_CHK $@
>        cmd_dtb =        $(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
> +quiet_cmd_dtbo = DTOVL_CHK $@
> +      cmd_dtbo = $(cmd_fdtoverlay) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
>  else
>  quiet_cmd_dtb = $(quiet_cmd_dtc)
>        cmd_dtb = $(cmd_dtc)
> +quiet_cmd_dtbo = $(quiet_cmd_fdtoverlay)
> +      cmd_dtbo = $(cmd_fdtoverlay)
>  endif
>
>  $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
> @@ -429,6 +429,10 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
>  $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
>         $(call if_changed_dep,dtc)
>
> +$(multi-dtb-y): FORCE
> +       $(call if_changed,dtbo)
> +$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
> +
>  dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
>
>  # Bzip2
> --
> 2.44.0
>
Rob Herring Feb. 27, 2024, 4:13 a.m. UTC | #2
On Mon, Feb 26, 2024 at 1:03 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> + Rob Herring, DT List
>
>
> On Mon, Feb 26, 2024 at 12:12 AM Alexander Stein
> <alexander.stein@mailbox.org> wrote:
> >
> > Add a similar mechanism as for regular DT files to call the DT checker
> > after applying DT overlays to base DT files.

I suspect this needs more work than just enabling checking. Otherwise,
I would have done just that. Depending on the split with an overlay,
we could see strange results.

The requirement in the kernel is overlays be applied to a base tree at
build time (though that is not checked ATM. When we check that result,
we're checking the overlay anyways. Obviously, that's a bit harder to
trace the source of errors, but it is otherwise redundant to check
overlays in addition.

Rob
diff mbox series

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 038a12e15586..964892b18f95 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -406,10 +406,6 @@  cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
 quiet_cmd_fdtoverlay = DTOVL   $@
       cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
 
-$(multi-dtb-y): FORCE
-	$(call if_changed,fdtoverlay)
-$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
-
 ifneq ($(CHECK_DTBS)$(CHECK_DT_BINDING),)
 DT_CHECKER ?= dt-validate
 DT_CHECKER_FLAGS ?= $(if $(DT_SCHEMA_FILES),-l $(DT_SCHEMA_FILES),-m)
@@ -418,9 +414,13 @@  DT_TMP_SCHEMA := $(objtree)/$(DT_BINDING_DIR)/processed-schema.json
 
 quiet_cmd_dtb =	DTC_CHK $@
       cmd_dtb =	$(cmd_dtc) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
+quiet_cmd_dtbo = DTOVL_CHK $@
+      cmd_dtbo = $(cmd_fdtoverlay) ; $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA) $@ || true
 else
 quiet_cmd_dtb = $(quiet_cmd_dtc)
       cmd_dtb = $(cmd_dtc)
+quiet_cmd_dtbo = $(quiet_cmd_fdtoverlay)
+      cmd_dtbo = $(cmd_fdtoverlay)
 endif
 
 $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
@@ -429,6 +429,10 @@  $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
 $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
 	$(call if_changed_dep,dtc)
 
+$(multi-dtb-y): FORCE
+	$(call if_changed,dtbo)
+$(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
+
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
 
 # Bzip2