diff mbox

[U-Boot,V2,3/9] dts/Makefile: simplify dtc invocation

Message ID 1372088629-14134-4-git-send-email-swarren@wwwdotorg.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren June 24, 2013, 3:43 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

The invocation of dtc is significantly more complex that it could be,
in order to work around an issue on old versions of dtc, which print
a message to stdout every time they run.

Remove this workaround, on the assumption that people have or will
upgrade to a newer version of dtc. This simplifies the build rule
significantly.

Related, split the invocation of cpp and dtc into separate commands
rather than a pipeline, so that if either fail, it is detected. This has
the nice benefit of saving off the result of the pre-processing step,
allowing it to be easily inspected.

Assuming a new enough dtc (which an earlier patch enforces), dtc will
parse #line directives in its input file, and generate correct file and
line numbers in error messages, even though cpp is unconditionally
applied to its input file.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2:
* Added note to commit description re: line numbers.
* s/.dtstmp/dts.tmp/ in temporary filenames.
---
 .gitignore   | 1 +
 dts/Makefile | 9 ++-------
 2 files changed, 3 insertions(+), 7 deletions(-)

Comments

Simon Glass June 25, 2013, 12:47 a.m. UTC | #1
On Mon, Jun 24, 2013 at 8:43 AM, Stephen Warren <swarren@wwwdotorg.org>wrote:

> From: Stephen Warren <swarren@nvidia.com>
> The invocation of dtc is significantly more complex that it could be,
> in order to work around an issue on old versions of dtc, which print
> a message to stdout every time they run.
>
> Remove this workaround, on the assumption that people have or will
> upgrade to a newer version of dtc. This simplifies the build rule
> significantly.
>
> Related, split the invocation of cpp and dtc into separate commands
> rather than a pipeline, so that if either fail, it is detected. This has
> the nice benefit of saving off the result of the pre-processing step,
> allowing it to be easily inspected.
>
> Assuming a new enough dtc (which an earlier patch enforces), dtc will
> parse #line directives in its input file, and generate correct file and
> line numbers in error messages, even though cpp is unconditionally
> applied to its input file.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
>

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

Patch

diff --git a/.gitignore b/.gitignore
index 4116448..7aa4adc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@ 
 *.patch
 *.bin
 *.cfgtmp
+*.dts.tmp
 
 # Build tree
 /build-*
diff --git a/dts/Makefile b/dts/Makefile
index 03e163e..722cc37 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -51,13 +51,8 @@  all:	$(obj).depend $(LIB)
 DT_BIN	:= $(obj)dt.dtb
 
 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
-	rc=$$( \
-		cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \
-		{ { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
-		    echo $$? >&3 ; } | \
-		  grep -v '^DTC: dts->dtb  on file' ; \
-	        } 3>&1 1>&2 ) ; \
-	exit $$rc
+	$(CPP) -P $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
+	$(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
 
 process_lds = \
 	$(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p'