diff mbox

[U-Boot] fdt: send all dtc output to stderr

Message ID 1339194497-24208-1-git-send-email-swarren@wwwdotorg.org
State Accepted
Commit 58e22f8a15adec39d24d060180d76a4cbe86a04b
Headers show

Commit Message

Stephen Warren June 8, 2012, 10:28 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Commit 896bbb5 "fdt: avoid bad MAKEALL status" added logic to capture
the result code from dtc by echoing $? to stdout and capturing it using
$(). However, dtc emits some diagnostics to stderr and some to stdout.
The diagnostics send to stdout ended up getting captured via $() rather
than being echo'd to the user. This caused those diagnostics to be passed
to the exit command, which would then fail with the following cryptic
error message:

    /bin/sh: line 1: exit: too many arguments

Solve this by redirecting all dtc output to stderr so that $() does not
capture it. This allows the user to see the actual error message from dtc.

Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: albert.u.boot@aribaud.net
Cc: Tom Warren <twarren@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 dts/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Simon Glass June 10, 2012, 3:21 a.m. UTC | #1
Hi Stephen,

On Fri, Jun 8, 2012 at 3:28 PM, Stephen Warren <swarren@wwwdotorg.org>wrote:

> From: Stephen Warren <swarren@nvidia.com>
>
> Commit 896bbb5 "fdt: avoid bad MAKEALL status" added logic to capture
> the result code from dtc by echoing $? to stdout and capturing it using
> $(). However, dtc emits some diagnostics to stderr and some to stdout.
> The diagnostics send to stdout ended up getting captured via $() rather
> than being echo'd to the user. This caused those diagnostics to be passed
> to the exit command, which would then fail with the following cryptic
> error message:
>
>    /bin/sh: line 1: exit: too many arguments
>
> Solve this by redirecting all dtc output to stderr so that $() does not
> capture it. This allows the user to see the actual error message from dtc.
>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: albert.u.boot@aribaud.net
> Cc: Tom Warren <twarren@nvidia.com>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>

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


> ---
>  dts/Makefile |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dts/Makefile b/dts/Makefile
> index 914e479..402dfe1 100644
> --- a/dts/Makefile
> +++ b/dts/Makefile
> @@ -51,7 +51,7 @@ $(DT_BIN):
> $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
>                { { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
>                    echo $$? >&3 ; } | \
>                  grep -v '^DTC: dts->dtb  on file' ; \
> -               } 3>&1 ) ; \
> +               } 3>&1 1>&2 ) ; \
>        exit $$rc
>
>  process_lds = \
> --
> 1.7.0.4
>
>
Wolfgang Denk July 9, 2012, 7:08 a.m. UTC | #2
Dear Stephen Warren,

In message <1339194497-24208-1-git-send-email-swarren@wwwdotorg.org> you wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> Commit 896bbb5 "fdt: avoid bad MAKEALL status" added logic to capture
> the result code from dtc by echoing $? to stdout and capturing it using
> $(). However, dtc emits some diagnostics to stderr and some to stdout.
> The diagnostics send to stdout ended up getting captured via $() rather
> than being echo'd to the user. This caused those diagnostics to be passed
> to the exit command, which would then fail with the following cryptic
> error message:
> 
>     /bin/sh: line 1: exit: too many arguments
> 
> Solve this by redirecting all dtc output to stderr so that $() does not
> capture it. This allows the user to see the actual error message from dtc.
> 
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: albert.u.boot@aribaud.net
> Cc: Tom Warren <twarren@nvidia.com>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
>  dts/Makefile |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/dts/Makefile b/dts/Makefile
index 914e479..402dfe1 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -51,7 +51,7 @@  $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
 		{ { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
 		    echo $$? >&3 ; } | \
 		  grep -v '^DTC: dts->dtb  on file' ; \
-	        } 3>&1 ) ; \
+	        } 3>&1 1>&2 ) ; \
 	exit $$rc
 
 process_lds = \