diff mbox series

[U-Boot,014/126] fdt: Show the preprocessed .dts file on error

Message ID 20190925145750.200592-15-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Add initial support for apollolake | expand

Commit Message

Simon Glass Sept. 25, 2019, 2:55 p.m. UTC
When device-tree compilation fails it is sometimes tricky to see which
line is broken, since the input file to dtc is a pre-processed version
of the device tree.

Add a line that points to the file that needs to be checked:

Output is something like this:

Error: arch/x86/dts/.chromebook_coral.dtb.pre.tmp:170.15-16 syntax error
FATAL ERROR: Unable to parse input tree
Check /tmp/b/chromebook_coral/arch/x86/dts/.chromebook_coral.dtb.pre.tmp
   for errors

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 scripts/Makefile.lib | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Bin Meng Oct. 4, 2019, 9:44 a.m. UTC | #1
Hi Simon,

On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
>
> When device-tree compilation fails it is sometimes tricky to see which
> line is broken, since the input file to dtc is a pre-processed version
> of the device tree.
>
> Add a line that points to the file that needs to be checked:
>
> Output is something like this:
>
> Error: arch/x86/dts/.chromebook_coral.dtb.pre.tmp:170.15-16 syntax error

This line already provides information that you need.

> FATAL ERROR: Unable to parse input tree
> Check /tmp/b/chromebook_coral/arch/x86/dts/.chromebook_coral.dtb.pre.tmp

I don't understand why we need another line that provides the same information.

>    for errors
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  scripts/Makefile.lib | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>

Regards,
Bin
Simon Glass Oct. 13, 2019, 3:03 p.m. UTC | #2
Hi Bin,

On Fri, 4 Oct 2019 at 03:45, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Wed, Sep 25, 2019 at 10:58 PM Simon Glass <sjg@chromium.org> wrote:
> >
> > When device-tree compilation fails it is sometimes tricky to see which
> > line is broken, since the input file to dtc is a pre-processed version
> > of the device tree.
> >
> > Add a line that points to the file that needs to be checked:
> >
> > Output is something like this:
> >
> > Error: arch/x86/dts/.chromebook_coral.dtb.pre.tmp:170.15-16 syntax error
>
> This line already provides information that you need.
>
> > FATAL ERROR: Unable to parse input tree
> > Check /tmp/b/chromebook_coral/arch/x86/dts/.chromebook_coral.dtb.pre.tmp
>
> I don't understand why we need another line that provides the same information.

Yes that is a bad example, I will update it. If a .dtsi has a CONFIG
it is not possible from the source file to work one what when wrong.


>
> >    for errors
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  scripts/Makefile.lib | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >

Regards,
Simon
diff mbox series

Patch

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index ef116e0e0ae..c10cd83a0a3 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -300,7 +300,9 @@  cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
 	$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
 	$(DTC) -O dtb -o $@ -b 0 \
 		-i $(dir $<) $(DTC_FLAGS) \
-		-d $(depfile).dtc.tmp $(dtc-tmp) ; \
+		-d $(depfile).dtc.tmp $(dtc-tmp) || \
+		(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
+		; \
 	cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
 	sed -i "s:$(pre-tmp):$(<):" $(depfile)