Commit cc4f427bbd7192b602310ee27ee34e3bfe81608b

Authored by Stephen Warren
Committed by Tom Rini
1 parent 6697d55862

dts/Makefile: simplify dtc invocation

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>

Showing 2 changed files with 3 additions and 7 deletions Side-by-side Diff

... ... @@ -16,6 +16,7 @@
16 16 *.patch
17 17 *.bin
18 18 *.cfgtmp
  19 +*.dts.tmp
19 20  
20 21 # Build tree
21 22 /build-*
... ... @@ -35,13 +35,8 @@
35 35 DT_BIN := $(obj)dt.dtb
36 36  
37 37 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
38   - rc=$$( \
39   - cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \
40   - { { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
41   - echo $$? >&3 ; } | \
42   - grep -v '^DTC: dts->dtb on file' ; \
43   - } 3>&1 1>&2 ) ; \
44   - exit $$rc
  38 + $(CPP) -P $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
  39 + $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
45 40  
46 41 process_lds = \
47 42 $(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p'