diff mbox series

kbuild: verify dtoverlay files against schema

Message ID 20240527-dtbo-check-schema-v1-1-ee1094f88f74@linaro.org (mailing list archive)
State New, archived
Headers show
Series kbuild: verify dtoverlay files against schema | expand

Commit Message

Dmitry Baryshkov May 27, 2024, 11:34 a.m. UTC
Currently only the single part device trees are validated against DT
schema. For the multipart schema files only the first file is validated.
Extend the fdtoverlay commands to validate the resulting DTB file
against schema.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 scripts/Makefile.lib | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


---
base-commit: 8314289a8d50a4e05d8ece1ae0445a3b57bb4d3b
change-id: 20240527-dtbo-check-schema-4f695cb98de5

Best regards,

Comments

Rob Herring (Arm) May 28, 2024, 1:15 p.m. UTC | #1
On Mon, May 27, 2024 at 6:34 AM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> Currently only the single part device trees are validated against DT
> schema. For the multipart schema files only the first file is validated.

What do you mean by multipart schema files? Did you mean multipart DTs
(i.e. base plus overlays)?

Looks good otherwise and I can fix that up.

> Extend the fdtoverlay commands to validate the resulting DTB file
> against schema.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  scripts/Makefile.lib | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 9f06f6aaf7fc..29da0dc9776d 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -407,8 +407,15 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
>                 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
>         cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
>
> +DT_CHECK_CMD = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA)
> +
> +ifneq ($(CHECK_DTBS),)
> +quiet_cmd_fdtoverlay = DTOVLCH $@
> +      cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) ; $(DT_CHECK_CMD) $@ || true
> +else
>  quiet_cmd_fdtoverlay = DTOVL   $@
>        cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
> +endif
>
>  $(multi-dtb-y): FORCE
>         $(call if_changed,fdtoverlay)
> @@ -421,7 +428,7 @@ DT_BINDING_DIR := Documentation/devicetree/bindings
>  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
> +      cmd_dtb =        $(cmd_dtc) ; $(DT_CHECK_CMD) $@ || true
>  else
>  quiet_cmd_dtb = $(quiet_cmd_dtc)
>        cmd_dtb = $(cmd_dtc)
>
> ---
> base-commit: 8314289a8d50a4e05d8ece1ae0445a3b57bb4d3b
> change-id: 20240527-dtbo-check-schema-4f695cb98de5
>
> Best regards,
> --
> Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
Dmitry Baryshkov May 28, 2024, 1:16 p.m. UTC | #2
On Tue, 28 May 2024 at 16:15, Rob Herring <robh@kernel.org> wrote:
>
> On Mon, May 27, 2024 at 6:34 AM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > Currently only the single part device trees are validated against DT
> > schema. For the multipart schema files only the first file is validated.
>
> What do you mean by multipart schema files? Did you mean multipart DTs
> (i.e. base plus overlays)?

Yes, multipart DT files, dts + dtso => dtb + dtbo => final dtb

>
> Looks good otherwise and I can fix that up.

Awesome, thanks!

>
> > Extend the fdtoverlay commands to validate the resulting DTB file
> > against schema.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >  scripts/Makefile.lib | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 9f06f6aaf7fc..29da0dc9776d 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -407,8 +407,15 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
> >                 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> >         cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
> >
> > +DT_CHECK_CMD = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA)
> > +
> > +ifneq ($(CHECK_DTBS),)
> > +quiet_cmd_fdtoverlay = DTOVLCH $@
> > +      cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) ; $(DT_CHECK_CMD) $@ || true
> > +else
> >  quiet_cmd_fdtoverlay = DTOVL   $@
> >        cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
> > +endif
> >
> >  $(multi-dtb-y): FORCE
> >         $(call if_changed,fdtoverlay)
> > @@ -421,7 +428,7 @@ DT_BINDING_DIR := Documentation/devicetree/bindings
> >  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
> > +      cmd_dtb =        $(cmd_dtc) ; $(DT_CHECK_CMD) $@ || true
> >  else
> >  quiet_cmd_dtb = $(quiet_cmd_dtc)
> >        cmd_dtb = $(cmd_dtc)
> >
> > ---
> > base-commit: 8314289a8d50a4e05d8ece1ae0445a3b57bb4d3b
> > change-id: 20240527-dtbo-check-schema-4f695cb98de5
> >
> > Best regards,
> > --
> > Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >
Masahiro Yamada May 29, 2024, 11:31 a.m. UTC | #3
On Tue, May 28, 2024 at 10:16 PM Dmitry Baryshkov
<dmitry.baryshkov@linaro.org> wrote:
>
> On Tue, 28 May 2024 at 16:15, Rob Herring <robh@kernel.org> wrote:
> >
> > On Mon, May 27, 2024 at 6:34 AM Dmitry Baryshkov
> > <dmitry.baryshkov@linaro.org> wrote:
> > >
> > > Currently only the single part device trees are validated against DT
> > > schema. For the multipart schema files only the first file is validated.
> >
> > What do you mean by multipart schema files? Did you mean multipart DTs
> > (i.e. base plus overlays)?
>
> Yes, multipart DT files, dts + dtso => dtb + dtbo => final dtb
>
> >
> > Looks good otherwise and I can fix that up.
>
> Awesome, thanks!




This looks equivalent to the former patch rejected by Rob Herring:

https://lore.kernel.org/lkml/20240225151209.343160-1-alexander.stein@mailbox.org/



Did he change his mind since then?









> >
> > > Extend the fdtoverlay commands to validate the resulting DTB file
> > > against schema.
> > >
> > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > ---
> > >  scripts/Makefile.lib | 9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > > index 9f06f6aaf7fc..29da0dc9776d 100644
> > > --- a/scripts/Makefile.lib
> > > +++ b/scripts/Makefile.lib
> > > @@ -407,8 +407,15 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
> > >                 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> > >         cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
> > >
> > > +DT_CHECK_CMD = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA)
> > > +
> > > +ifneq ($(CHECK_DTBS),)
> > > +quiet_cmd_fdtoverlay = DTOVLCH $@
> > > +      cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) ; $(DT_CHECK_CMD) $@ || true
> > > +else
> > >  quiet_cmd_fdtoverlay = DTOVL   $@
> > >        cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
> > > +endif
> > >
> > >  $(multi-dtb-y): FORCE
> > >         $(call if_changed,fdtoverlay)
> > > @@ -421,7 +428,7 @@ DT_BINDING_DIR := Documentation/devicetree/bindings
> > >  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
> > > +      cmd_dtb =        $(cmd_dtc) ; $(DT_CHECK_CMD) $@ || true
> > >  else
> > >  quiet_cmd_dtb = $(quiet_cmd_dtc)
> > >        cmd_dtb = $(cmd_dtc)
> > >
> > > ---
> > > base-commit: 8314289a8d50a4e05d8ece1ae0445a3b57bb4d3b
> > > change-id: 20240527-dtbo-check-schema-4f695cb98de5
> > >
> > > Best regards,
> > > --
> > > Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > >
>
>
>
> --
> With best wishes
> Dmitry



--
Best Regards
Masahiro Yamada
Rob Herring (Arm) May 29, 2024, 1:21 p.m. UTC | #4
On Wed, May 29, 2024 at 6:31 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Tue, May 28, 2024 at 10:16 PM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Tue, 28 May 2024 at 16:15, Rob Herring <robh@kernel.org> wrote:
> > >
> > > On Mon, May 27, 2024 at 6:34 AM Dmitry Baryshkov
> > > <dmitry.baryshkov@linaro.org> wrote:
> > > >
> > > > Currently only the single part device trees are validated against DT
> > > > schema. For the multipart schema files only the first file is validated.
> > >
> > > What do you mean by multipart schema files? Did you mean multipart DTs
> > > (i.e. base plus overlays)?
> >
> > Yes, multipart DT files, dts + dtso => dtb + dtbo => final dtb
> >
> > >
> > > Looks good otherwise and I can fix that up.
> >
> > Awesome, thanks!
>
>
>
>
> This looks equivalent to the former patch rejected by Rob Herring:
>
> https://lore.kernel.org/lkml/20240225151209.343160-1-alexander.stein@mailbox.org/
>
>
>
> Did he change his mind since then?

I think I misinterpreted the prior one to be checking just overlays
rather than base+overlay seeing the 'dtbo' in it.

Of the 2, this patch seems a bit cleaner.

Rob
Dmitry Baryshkov June 13, 2024, 11:46 p.m. UTC | #5
On Tue, 28 May 2024 at 16:15, Rob Herring <robh@kernel.org> wrote:
>
> On Mon, May 27, 2024 at 6:34 AM Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > Currently only the single part device trees are validated against DT
> > schema. For the multipart schema files only the first file is validated.
>
> What do you mean by multipart schema files? Did you mean multipart DTs
> (i.e. base plus overlays)?
>
> Looks good otherwise and I can fix that up.

This patch was sent two weeks ago. Is there anything on me with respect to it?

> > Extend the fdtoverlay commands to validate the resulting DTB file
> > against schema.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > ---
> >  scripts/Makefile.lib | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 9f06f6aaf7fc..29da0dc9776d 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -407,8 +407,15 @@ cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
> >                 -d $(depfile).dtc.tmp $(dtc-tmp) ; \
> >         cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
> >
> > +DT_CHECK_CMD = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA)
> > +
> > +ifneq ($(CHECK_DTBS),)
> > +quiet_cmd_fdtoverlay = DTOVLCH $@
> > +      cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) ; $(DT_CHECK_CMD) $@ || true
> > +else
> >  quiet_cmd_fdtoverlay = DTOVL   $@
> >        cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
> > +endif
> >
> >  $(multi-dtb-y): FORCE
> >         $(call if_changed,fdtoverlay)
> > @@ -421,7 +428,7 @@ DT_BINDING_DIR := Documentation/devicetree/bindings
> >  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
> > +      cmd_dtb =        $(cmd_dtc) ; $(DT_CHECK_CMD) $@ || true
> >  else
> >  quiet_cmd_dtb = $(quiet_cmd_dtc)
> >        cmd_dtb = $(cmd_dtc)
> >
> > ---
> > base-commit: 8314289a8d50a4e05d8ece1ae0445a3b57bb4d3b
> > change-id: 20240527-dtbo-check-schema-4f695cb98de5
> >
> > Best regards,
> > --
> > Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >
Rob Herring (Arm) June 26, 2024, 2:56 p.m. UTC | #6
On Mon, 27 May 2024 14:34:24 +0300, Dmitry Baryshkov wrote:
> Currently only the single part device trees are validated against DT
> schema. For the multipart schema files only the first file is validated.
> Extend the fdtoverlay commands to validate the resulting DTB file
> against schema.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>  scripts/Makefile.lib | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 

Applied, thanks!
diff mbox series

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 9f06f6aaf7fc..29da0dc9776d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -407,8 +407,15 @@  cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ;
 		-d $(depfile).dtc.tmp $(dtc-tmp) ; \
 	cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
 
+DT_CHECK_CMD = $(DT_CHECKER) $(DT_CHECKER_FLAGS) -u $(srctree)/$(DT_BINDING_DIR) -p $(DT_TMP_SCHEMA)
+
+ifneq ($(CHECK_DTBS),)
+quiet_cmd_fdtoverlay = DTOVLCH $@
+      cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs) ; $(DT_CHECK_CMD) $@ || true
+else
 quiet_cmd_fdtoverlay = DTOVL   $@
       cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
+endif
 
 $(multi-dtb-y): FORCE
 	$(call if_changed,fdtoverlay)
@@ -421,7 +428,7 @@  DT_BINDING_DIR := Documentation/devicetree/bindings
 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
+      cmd_dtb =	$(cmd_dtc) ; $(DT_CHECK_CMD) $@ || true
 else
 quiet_cmd_dtb = $(quiet_cmd_dtc)
       cmd_dtb = $(cmd_dtc)