[U-Boot] [PATCH 01/15] fdt: Use sed instead of cpp to pre-process the dtc

Simon Glass sjg at chromium.org
Wed Dec 26 23:28:19 CET 2012


Include file support in dtc is still not available in common distributions
so we need to keep our preprocessing arrangement around for a little
longer.

But # is commonly used in FDT files, so use sed instead of cpp for this
preprocessing.

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 dts/Makefile |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/dts/Makefile b/dts/Makefile
index 785104e..76f1461 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -35,11 +35,6 @@ $(if $(CONFIG_ARCH_DEVICE_TREE),,\
 $(error Your architecture does not have device tree support enabled. \
 Please define CONFIG_ARCH_DEVICE_TREE))
 
-# We preprocess the device tree file provide a useful define
-DTS_CPPFLAGS := -ansi \
-		-DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
-		-DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\"
-
 all:	$(obj).depend $(LIB)
 
 # Use a constant name for this so we can access it from C code.
@@ -49,7 +44,10 @@ DT_BIN	:= $(obj)dt.dtb
 
 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
 	rc=$$( \
-		cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \
+		cat $< \
+		| sed '{s#ARCH_CPU_DTS#"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi"#; \
+			s#BOARD_DTS#$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts#}' | \
+		tee dts.tmp | \
 		{ { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \
 		    echo $$? >&3 ; } | \
 		  grep -v '^DTC: dts->dtb  on file' ; \
-- 
1.7.7.3



More information about the U-Boot mailing list