Skip to contentSkip to conversation

rely on latest dtc, simplify

PATCH Superseded Stephen Warren 5 participants 19 messages Jun 24, 2013 – Jul 24, 2013

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover rely on latest dtc, simplify

From: Stephen Warren <[email protected]>

This is a series of patches which simplifies the rules to build *.dts in U-Boot by relying on features in the latest dtc. The include rules are made more consistent between cpp (when processing *.dts) and dtc. The cpp flags are made more consistent with the way the kernel processes *.dts to allow better portability of *.dts between the two.

I'm sending V2 now that dtc-1.4.0 has been tagged/released, and hence there's a version number that patch 1/9 "Validate dtc is new enough" can check for. I'll leave it up to you whether this series is applicable for the current or next release.

Stephen Warren (9):
Validate dtc is new enough
xilinx: move microblaze-generic .dts to standard location dts/Makefile: simplify dtc invocation dts/Makefile: unify cpp/dtc include paths
dt: don't use ARCH_CPU_DTS
dts/Makefile: don't define ARCH_CPU_DTS, BOARD_DTS
config: don't define CONFIG_ARCH_DEVICE_TREE dts/Makefile: don't use cpp -P
dts/Makefile: pass -undef -D__DTS__ to cpp

 .gitignore                                         |  1 +
 Makefile                                           |  8 ++++++-
 arch/arm/cpu/armv7/tegra114/config.mk              | 19 ----------------
 arch/arm/cpu/armv7/tegra20/config.mk               | 26 ----------------------
 arch/arm/cpu/armv7/tegra30/config.mk               | 19 ----------------
 arch/microblaze/config.mk                          |  2 --
 arch/x86/cpu/coreboot/config.mk                    | 23 -------------------
 board/chromebook-x86/dts/link.dts                  |  2 +-
 board/samsung/dts/exynos5250-smdk5250.dts          |  2 +-
 board/samsung/dts/exynos5250-snow.dts              |  2 +-
 .../microblaze.dts => dts/microblaze-generic.dts}  |  0
 board/xilinx/dts/microblaze.dts                    |  1 -
 config.mk                                          |  1 +
 doc/README.fdt-control                             |  3 +--
 dts/Makefile                                       | 25 +++++++++------------
 include/configs/exynos5250-dt.h                    |  1 -
 include/configs/microblaze-generic.h               |  2 +-
 tools/dtc-version.sh                               | 20 +++++++++++++++++
 18 files changed, 44 insertions(+), 113 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/tegra114/config.mk
 delete mode 100644 arch/arm/cpu/armv7/tegra20/config.mk
 delete mode 100644 arch/arm/cpu/armv7/tegra30/config.mk
 delete mode 100644 arch/x86/cpu/coreboot/config.mk
 rename board/xilinx/{microblaze-generic/dts/microblaze.dts => dts/microblaze-generic.dts} (100%)
 delete mode 100644 board/xilinx/dts/microblaze.dts
 create mode 100755 tools/dtc-version.sh
Signature · 1 line
1.8.1.5
#1 lore raw

PATCH v2 1/9 Validate dtc is new enough

From: Stephen Warren <[email protected]>

Subsequent patches assume that dtc supports various recent features. These are available in dtc 1.4.0. Validate that dtc is at least that version.

---
v2: New patch.

---
 Makefile             |  8 +++++++-
 config.mk            |  1 +
 tools/dtc-version.sh | 20 ++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100755 tools/dtc-version.sh
Makefile +7 -1
index 50880c9..f167458 100644
@@ -428,7 +428,7 @@ endif
 
 all:		$(ALL-y) $(SUBDIR_EXAMPLES)
 
-$(obj)u-boot.dtb:	$(obj)u-boot
+$(obj)u-boot.dtb:	checkdtc $(obj)u-boot
 		$(MAKE) -C dts binary
 		mv $(obj)dts/dt.dtb $@
 
@@ -686,6 +686,12 @@ checkgcc4:
 		false; \
 	fi
 
+checkdtc:
+	@if test $(call dtc-version) -lt 0104; then \
+		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
+		false; \
+	fi
+
 #
 # Auto-generate the autoconf.mk file (which is included by all makefiles)
 #
config.mk +1 -0
index 6e17ed8..32643ec 100644
@@ -136,6 +136,7 @@ endif
 # Usage gcc-ver := $(call cc-version)
 cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
 binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh $(AS))
+dtc-version = $(shell $(SHELL) $(SRCTREE)/tools/dtc-version.sh $(DTC))
 
 #
 # Include the make variables (CC, etc...)
tools/dtc-version.sh new file +20 -0
new file mode 100755
index 0000000..e8c94d3
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# dtc-version dtc-command
+#
+# Prints the dtc version of `dtc-command' in a canonical 4-digit form
+# such as `0222' for binutils 2.22
+#
+
+dtc="$*"
+
+if [ ${#dtc} -eq 0 ]; then
+	echo "Error: No dtc command specified."
+	printf "Usage:\n\t$0 <dtc-command>\n"
+	exit 1
+fi
+
+MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1)
+MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2)
+
+printf "%02d%02d\\n" $MAJOR $MINOR
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH v2 1/9 Validate dtc is new enough

Hi Stephen,

Quoted 10 lines · Stephen Warren

From: Stephen Warren <[email protected]>

Subsequent patches assume that dtc supports various recent features. These are available in dtc 1.4.0. Validate that dtc is at least that version.

---
v2: New patch.

See note below.

Quoted 12 lines
---
 Makefile             |  8 +++++++-
 config.mk            |  1 +
 tools/dtc-version.sh | 20 ++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100755 tools/dtc-version.sh
Makefile +0 -0
index 50880c9..f167458 100644

Makefile endif · line 432

Quoted 6 lines
Makefile +1 -1
@@ -428,7 +428,7 @@ endif
 
 all:           $(ALL-y) $(SUBDIR_EXAMPLES)
 
-$(obj)u-boot.dtb:      $(obj)u-boot
+$(obj)u-boot.dtb:      checkdtc $(obj)u-boot
 

Any reason this is not in dts/Makefile? Still this is fine.

Quoted 60 lines
Makefile +6 -0
                $(MAKE) -C dts binary
                mv $(obj)dts/dt.dtb $@
@@ -686,6 +686,12 @@ checkgcc4:
                false; \
        fi
 
+checkdtc:
+       @if test $(call dtc-version) -lt 0104; then \
+               echo '*** Your dtc is too old, please upgrade to dtc 1.4
 or newer'; \
+               false; \
+       fi
+
 #
 # Auto-generate the autoconf.mk file (which is included by all makefiles)

#

config.mk +1 -0
index 6e17ed8..32643ec 100644
@@ -136,6 +136,7 @@ endif
 # Usage gcc-ver := $(call cc-version)
 cc-version = $(shell $(SHELL) $(SRCTREE)/tools/gcc-version.sh $(CC))
 binutils-version = $(shell $(SHELL) $(SRCTREE)/tools/binutils-version.sh
 $(AS))
+dtc-version = $(shell $(SHELL) $(SRCTREE)/tools/dtc-version.sh $(DTC))
 
 #

# Include the make variables (CC, etc...)

tools/dtc-version.sh new file +20 -1
new file mode 100755
index 0000000..e8c94d3
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# dtc-version dtc-command
+#
+# Prints the dtc version of `dtc-command' in a canonical 4-digit form
+# such as `0222' for binutils 2.22
+#
+
+dtc="$*"
+
+if [ ${#dtc} -eq 0 ]; then
+       echo "Error: No dtc command specified."
+       printf "Usage:\n\t$0 <dtc-command>\n"
+       exit 1
+fi
+
+MAJOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 1)
+MINOR=$($dtc -v | head -1 | awk '{print $NF}' | cut -d . -f 2)
+
+printf "%02d%02d\\n" $MAJOR $MINOR
--

1.8.1.5

#3 lore raw

PATCH v2 1/9 Validate dtc is new enough

Quoted 16 lines · Simon Glass

Hi Stephen,

On Mon, Jun 24, 2013 at 8:43 AM, Stephen Warren <[email protected] <mailto:[email protected]>> wrote:

From: Stephen Warren <swarren at nvidia.com <mailto:[email protected]>>

Subsequent patches assume that dtc supports various recent features. These are available in dtc 1.4.0. Validate that dtc is at least that version.

Acked-by Simon Glass <sjg at chromium.org <mailto:[email protected]>>

See note below.

Quoted 7 lines
    diff --git a/Makefile b/Makefile

    -$(obj)u-boot.dtb:      $(obj)u-boot
    +$(obj)u-boot.dtb:      checkdtc $(obj)u-boot

Any reason this is not in dts/Makefile? Still this is fine.

I guess that would have worked too. One advantage of the current placement is that make just happens to evaluate the rule really early (at least with more than -j1!), so you don't build a lot before it errors out, thus giving you quicker feedback. It also keeps all the tool version checks in one file; perhaps easier maintenance?

#4 lore raw

PATCH v2 1/9 Validate dtc is new enough

Hi Stephen,

Quoted 24 lines · Stephen Warren
Quoted 23 lines · Simon Glass

Hi Stephen,

On Mon, Jun 24, 2013 at 8:43 AM, Stephen Warren <[email protected] <mailto:[email protected]>> wrote:

From: Stephen Warren <swarren at nvidia.com <mailto:[email protected]

Quoted 1 line

Subsequent patches assume that dtc supports various recent features. These are available in dtc 1.4.0. Validate that dtc is at least that version.

Acked-by Simon Glass <sjg at chromium.org <mailto:[email protected]>>

See note below.

    diff --git a/Makefile b/Makefile

    -$(obj)u-boot.dtb:      $(obj)u-boot
    +$(obj)u-boot.dtb:      checkdtc $(obj)u-boot
Quoted 8 lines
Quoted 1 line

Any reason this is not in dts/Makefile? Still this is fine.

I guess that would have worked too. One advantage of the current placement is that make just happens to evaluate the rule really early (at least with more than -j1!), so you don't build a lot before it errors out, thus giving you quicker feedback. It also keeps all the tool version checks in one file; perhaps easier maintenance?

Sounds good to me.

Regards,
Simon

#5 lore raw

PATCH v2 1/9 Validate dtc is new enough

In reply to Stephen Warren

Makefile checkgcc4: · line 693

Quoted 6 lines · Stephen Warren
Makefile +5 -0
+checkdtc:
+	@if test $(call dtc-version) -lt 0104; then \
+		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
+		false; \
+	fi

... and ...

tools/dtc-version.sh line 7

Quoted 10 lines
tools/dtc-version.sh new file +7 -0
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# dtc-version dtc-command
+#
+# Prints the dtc version of `dtc-command' in a canonical 4-digit form
+# such as `0222' for binutils 2.22
+#

So the numbers get converted to something that's neatly aligned and free of whitespace and can get sorted alphabetically.

But the numbers get passed to $SHELL and the builtin test(1) command, and get compared numerically ('-lt' operator).

Does that mean that the test break with digits beyond seven, when numbers no longer can get interpreted as valid octal numbers?

virtually yours
Gerhard Sittig

Signature · 3 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
#6 lore raw

PATCH v2 1/9 Validate dtc is new enough

Quoted 24 lines · Gerhard Sittig

Makefile checkgcc4: · line 693

Quoted 6 lines · Stephen Warren
Makefile +5 -0
+checkdtc:
+	@if test $(call dtc-version) -lt 0104; then \
+		echo '*** Your dtc is too old, please upgrade to dtc 1.4 or newer'; \
+		false; \
+	fi

... and ...

tools/dtc-version.sh line 7

Quoted 10 lines
tools/dtc-version.sh new file +7 -0
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# dtc-version dtc-command
+#
+# Prints the dtc version of `dtc-command' in a canonical 4-digit form
+# such as `0222' for binutils 2.22
+#

So the numbers get converted to something that's neatly aligned and free of whitespace and can get sorted alphabetically.

Quoted 5 lines

But the numbers get passed to $SHELL and the builtin test(1) command, and get compared numerically ('-lt' operator).

Does that mean that the test break with digits beyond seven, when numbers no longer can get interpreted as valid octal numbers?

I'm pretty sure sh treats the numbers as decimal. Testing appears to support this:

[swarren at swarren-lx1 kernel.git]$ if [ 0104 -lt 0104 ]; then echo yes; else echo no; fi
no

[swarren at swarren-lx1 kernel.git]$ if [ 0103 -lt 0104 ]; then echo yes; else echo no; fi
yes

[swarren at swarren-lx1 kernel.git]$ if [ 0803 -lt 0104 ]; then echo yes; else echo no; fi
no

[swarren at swarren-lx1 kernel.git]$ if [ 0802 -lt 0804 ]; then echo yes; else echo no; fi
yes

[swarren at swarren-lx1 kernel.git]$ if [ 0804 -lt 0804 ]; then echo yes; else echo no; fi
no

[swarren at swarren-lx1 kernel.git]$ if [ 0806 -lt 0804 ]; then echo yes; else echo no; fi
no

#7 lore raw

PATCH v2 2/9 xilinx: move microblaze-generic .dts to standard location

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

Aside from microblaze, all other SoCs/boards/vendors store their DT files in board/$vendor/dts/$soc-$board.dts. Move microblaze-generic.dts to this location for consistency.

---
 .../dts/microblaze.dts => dts/microblaze-generic.dts}                   | 0
 board/xilinx/dts/microblaze.dts                                         | 1 -
 include/configs/microblaze-generic.h                                    | 2 +-
 3 files changed, 1 insertion(+), 2 deletions(-)
 rename board/xilinx/{microblaze-generic/dts/microblaze.dts => dts/microblaze-generic.dts} (100%)
 delete mode 100644 board/xilinx/dts/microblaze.dts
board/xilinx/dts/microblaze-generic.dts renamed from board/xilinx/microblaze-generic/dts/microblaze.dts +0 -0
similarity index 100%
rename from board/xilinx/microblaze-generic/dts/microblaze.dts
rename to board/xilinx/dts/microblaze-generic.dts
board/xilinx/dts/microblaze.dts deleted +0 -1
deleted file mode 100644
index bf984b0..0000000
@@ -1 +0,0 @@
-/include/ BOARD_DTS
include/configs/microblaze-generic.h +1 -1
index 17f53ba..ad91d21 100644
@@ -34,7 +34,7 @@
 /* Open Firmware DTS */
 #define CONFIG_OF_CONTROL	1
 #define CONFIG_OF_EMBED		1
-#define CONFIG_DEFAULT_DEVICE_TREE microblaze
+#define CONFIG_DEFAULT_DEVICE_TREE microblaze-generic
 
 /* linear and spi flash memory */
 #ifdef XILINX_FLASH_START
Signature · 1 line
1.8.1.5
#8 lore raw

PATCH v2 3/9 dts/Makefile: simplify dtc invocation

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

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.

---
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(-)
.gitignore +1 -0
index 4116448..7aa4adc 100644
@@ -16,6 +16,7 @@
 *.patch
 *.bin
 *.cfgtmp
+*.dts.tmp
 
 # Build tree
 /build-*
dts/Makefile +2 -7
index 03e163e..722cc37 100644
@@ -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'
Signature · 1 line
1.8.1.5
#9 lore raw

PATCH v2 3/9 dts/Makefile: simplify dtc invocation

Quoted 14 lines · Stephen Warren

From: Stephen Warren <[email protected]>
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.

Quoted 7 lines

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.

#10 lore raw

PATCH v2 4/9 dts/Makefile: unify cpp/dtc include paths

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

*.dts may use #include (via cpp) or /include/ (via dtc; assuming a newer dtc). The choice is up to the creator of the DT. Create a common variable DTC_INCDIRS that lists the paths searched by include statements, and update cpp and dtc invocation to use them.

For cpp, also specify -nostdinc to ensure the same set of paths is available to both type of include statement.

For dtc, create a new DTC_FLAGS variable to hold all the flags passed to dtc.

---
 dts/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
dts/Makefile +9 -2
index 722cc37..ce774e0 100644
@@ -37,11 +37,18 @@ $(if $(CONFIG_ARCH_DEVICE_TREE),,\
 $(error Your architecture does not have device tree support enabled. \
 Please define CONFIG_ARCH_DEVICE_TREE))
 
+DTS_INCDIRS =  $(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts
+DTS_INCDIRS += $(SRCTREE)/board/$(VENDOR)/dts
+DTS_INCDIRS += $(SRCTREE)/arch/$(ARCH)/dts
+
 # We preprocess the device tree file provide a useful define
 DTS_CPPFLAGS := -x assembler-with-cpp \
 		-DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
 		-DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\" \
-		-I$(SRCTREE)/board/$(VENDOR)/dts -I$(SRCTREE)/arch/$(ARCH)/dts
+		-nostdinc $(addprefix -I,$(DTS_INCDIRS))
+
+DTC_FLAGS := -R 4 -p 0x1000 \
+	$(addprefix -i ,$(DTS_INCDIRS))
 
 all:	$(obj).depend $(LIB)
 
@@ -52,7 +59,7 @@ DT_BIN	:= $(obj)dt.dtb
 
 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
 	$(CPP) -P $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
-	$(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
+	$(DTC) $(DTC_FLAGS) -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
 
 process_lds = \
 	$(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p'
Signature · 1 line
1.8.1.5
#11 lore raw

PATCH v2 5/9 dt: don't use ARCH_CPU_DTS

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

Now that we assume dtc supports the -i option, we don't need to use ARCH_CPU_DTS in *.dts{,i}; we simply specify the include filename directly, and dtc will find it.

---
 board/chromebook-x86/dts/link.dts         | 2 +-
 board/samsung/dts/exynos5250-smdk5250.dts | 2 +-
 board/samsung/dts/exynos5250-snow.dts     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
board/chromebook-x86/dts/link.dts +1 -1
index d0738cb..c95ee8a 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ ARCH_CPU_DTS
+/include/ "coreboot.dtsi"
 
 / {
         #address-cells = <1>;
board/samsung/dts/exynos5250-smdk5250.dts +1 -1
index 8da973b..538b820 100644
@@ -10,7 +10,7 @@
 */
 
 /dts-v1/;
-/include/ ARCH_CPU_DTS
+/include/ "exynos5250.dtsi"
 
 / {
 	model = "SAMSUNG SMDK5250 board based on EXYNOS5250";
board/samsung/dts/exynos5250-snow.dts +1 -1
index 24658c1..30c22c9 100644
@@ -10,7 +10,7 @@
 */
 
 /dts-v1/;
-/include/ ARCH_CPU_DTS
+/include/ "exynos5250.dtsi"
 
 / {
 	model = "Google Snow";
Signature · 1 line
1.8.1.5
#12 lore raw

PATCH v2 6/9 dts/Makefile: don't define ARCH_CPU_DTS, BOARD_DTS

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

Now that nothing uses the defines ARCH_CPU_DTS, BOARD_DTS, stop defining them.

---
 dts/Makefile | 7 -------
 1 file changed, 7 deletions(-)
dts/Makefile +0 -7
index ce774e0..42ba42f 100644
@@ -33,18 +33,11 @@ $(error Please define CONFIG_DEFAULT_DEVICE_TREE in your board header file))
 DEVICE_TREE = $(subst ",,$(CONFIG_DEFAULT_DEVICE_TREE))
 endif
 
-$(if $(CONFIG_ARCH_DEVICE_TREE),,\
-$(error Your architecture does not have device tree support enabled. \
-Please define CONFIG_ARCH_DEVICE_TREE))
-
 DTS_INCDIRS =  $(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts
 DTS_INCDIRS += $(SRCTREE)/board/$(VENDOR)/dts
 DTS_INCDIRS += $(SRCTREE)/arch/$(ARCH)/dts
 
-# We preprocess the device tree file provide a useful define
 DTS_CPPFLAGS := -x assembler-with-cpp \
-		-DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
-		-DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\" \
 		-nostdinc $(addprefix -I,$(DTS_INCDIRS))
 
 DTC_FLAGS := -R 4 -p 0x1000 \
Signature · 1 line
1.8.1.5
#13 lore raw

PATCH v2 7/9 config: don't define CONFIG_ARCH_DEVICE_TREE

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

Now that nothing uses CONFIG_ARCH_DEVICE_TREE, stop defining it.

---
 arch/arm/cpu/armv7/tegra114/config.mk | 19 -------------------
 arch/arm/cpu/armv7/tegra20/config.mk  | 26 --------------------------
 arch/arm/cpu/armv7/tegra30/config.mk  | 19 -------------------
 arch/microblaze/config.mk             |  2 --
 arch/x86/cpu/coreboot/config.mk       | 23 -----------------------
 doc/README.fdt-control                |  3 +--
 include/configs/exynos5250-dt.h       |  1 -
 7 files changed, 1 insertion(+), 92 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/tegra114/config.mk
 delete mode 100644 arch/arm/cpu/armv7/tegra20/config.mk
 delete mode 100644 arch/arm/cpu/armv7/tegra30/config.mk
 delete mode 100644 arch/x86/cpu/coreboot/config.mk
arch/arm/cpu/armv7/tegra114/config.mk deleted +0 -19
deleted file mode 100644
index cb1a19d..0000000
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved.
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <[email protected]>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-CONFIG_ARCH_DEVICE_TREE := tegra114
arch/arm/cpu/armv7/tegra20/config.mk deleted +0 -26
deleted file mode 100644
index 6432e75..0000000
@@ -1,26 +0,0 @@
-#
-# (C) Copyright 2010,2011
-# NVIDIA Corporation <www.nvidia.com>
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <[email protected]>
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-CONFIG_ARCH_DEVICE_TREE := tegra20
arch/arm/cpu/armv7/tegra30/config.mk deleted +0 -19
deleted file mode 100644
index 719ca81..0000000
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2010-2012, NVIDIA CORPORATION.  All rights reserved.
-#
-# (C) Copyright 2002
-# Gary Jennejohn, DENX Software Engineering, <[email protected]>
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-# more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-CONFIG_ARCH_DEVICE_TREE := tegra30
arch/microblaze/config.mk +0 -2
index b4935f0..aca79e2 100644
@@ -31,5 +31,3 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
 
 LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
-
-CONFIG_ARCH_DEVICE_TREE := microblaze
arch/x86/cpu/coreboot/config.mk deleted +0 -23
deleted file mode 100644
index 4858fc3..0000000
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2012 The Chromium OS Authors.
-#
-# See file CREDITS for list of people who contributed to this
-# project.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-# MA 02111-1307 USA
-#
-
-CONFIG_ARCH_DEVICE_TREE := coreboot
doc/README.fdt-control +1 -2
index 95a88a7..8512beb 100644
@@ -135,8 +135,7 @@ file into
 	board/<vendor>/dts/<name>.dts
 
 This should include your CPU or SOC's device tree file, placed in
-arch/<arch>/dts, and then make any adjustments required. The name of this
-is CONFIG_ARCH_DEVICE_TREE.dts.
+arch/<arch>/dts, and then make any adjustments required.
 
 If CONFIG_OF_EMBED is defined, then it will be picked up and built into
 the U-Boot image (including u-boot.bin).
include/configs/exynos5250-dt.h +0 -1
index 8a82892..a749c42 100644
@@ -39,7 +39,6 @@
 #define CONFIG_DISPLAY_BOARDINFO
 
 /* Enable fdt support for Exynos5250 */
-#define CONFIG_ARCH_DEVICE_TREE		exynos5250
 #define CONFIG_OF_CONTROL
 #define CONFIG_OF_SEPARATE
 
Signature · 1 line
1.8.1.5
#14 lore raw

PATCH v2 8/9 dts/Makefile: don't use cpp -P

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

Recent dtc supports #line directives in the input source code, and even uses them to generate useful line numbers in any messages it emits. Stop passing -P to cpp, since there's no need any more.

---
 dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dts/Makefile +1 -1
index 42ba42f..805d2cc 100644
@@ -51,7 +51,7 @@ all:	$(obj).depend $(LIB)
 DT_BIN	:= $(obj)dt.dtb
 
 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
-	$(CPP) -P $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
+	$(CPP) $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
 	$(DTC) $(DTC_FLAGS) -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
 
 process_lds = \
Signature · 1 line
1.8.1.5
#15 lore raw

PATCH v2 9/9 dts/Makefile: pass -undef -D__DTS__ to cpp

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

This brings U-Boot's cpp invocation into line with the way the Linux kernel invokes cpp on device trees. Consistency will be useful to ensure *.dts is portable between the two.

-undef also has the added advantage of not defining "linux", so DT property names such as "linux,keymap" don't get mangled.

---
 dts/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
dts/Makefile +1 -1
index 805d2cc..b125bd3 100644
@@ -37,7 +37,7 @@ DTS_INCDIRS =  $(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts
 DTS_INCDIRS += $(SRCTREE)/board/$(VENDOR)/dts
 DTS_INCDIRS += $(SRCTREE)/arch/$(ARCH)/dts
 
-DTS_CPPFLAGS := -x assembler-with-cpp \
+DTS_CPPFLAGS := -x assembler-with-cpp -undef -D__DTS__ \
 		-nostdinc $(addprefix -I,$(DTS_INCDIRS))
 
 DTC_FLAGS := -R 4 -p 0x1000 \
Signature · 1 line
1.8.1.5
#16 lore raw

v2 cover rely on latest dtc, simplify

In reply to Stephen Warren
Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This is a series of patches which simplifies the rules to build *.dts in U-Boot by relying on features in the latest dtc. The include rules are made more consistent between cpp (when processing *.dts) and dtc. The cpp flags are made more consistent with the way the kernel processes *.dts to allow better portability of *.dts between the two.

Quoted 4 lines

I'm sending V2 now that dtc-1.4.0 has been tagged/released, and hence there's a version number that patch 1/9 "Validate dtc is new enough" can check for. I'll leave it up to you whether this series is applicable for the current or next release.

OK, thanks. I'm going to hold this out of the upcoming release but spell out in the release notes that change is coming.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130624/f08042ce/attachment.pgp>
#17 lore raw

v2 cover rely on latest dtc, simplify

In reply to Stephen Warren
Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This is a series of patches which simplifies the rules to build *.dts in U-Boot by relying on features in the latest dtc. The include rules are made more consistent between cpp (when processing *.dts) and dtc. The cpp flags are made more consistent with the way the kernel processes *.dts to allow better portability of *.dts between the two.

Quoted 4 lines

I'm sending V2 now that dtc-1.4.0 has been tagged/released, and hence there's a version number that patch 1/9 "Validate dtc is new enough" can check for. I'll leave it up to you whether this series is applicable for the current or next release.

Tom,

Do you want me to repost this series now the release is out? I have at least picked up some acks locally.

Note that at least a couple of distros have already packaged the new version of dtc in their latest releases; see the links at:

https://bugs.launchpad.net/debian/+source/device-tree-compiler/+bug/1194183

#18 lore raw

v2 cover rely on latest dtc, simplify

Quoted 14 lines · Stephen Warren
Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This is a series of patches which simplifies the rules to build *.dts in U-Boot by relying on features in the latest dtc. The include rules are made more consistent between cpp (when processing *.dts) and dtc. The cpp flags are made more consistent with the way the kernel processes *.dts to allow better portability of *.dts between the two.

Quoted 4 lines

I'm sending V2 now that dtc-1.4.0 has been tagged/released, and hence there's a version number that patch 1/9 "Validate dtc is new enough" can check for. I'll leave it up to you whether this series is applicable for the current or next release.

Quoted 4 lines

Tom,

Do you want me to repost this series now the release is out? I have at least picked up some acks locally.

Yeah, lets do that to let the acks be picked up.

Quoted 4 lines

Note that at least a couple of distros have already packaged the new version of dtc in their latest releases; see the links at:

https://bugs.launchpad.net/debian/+source/device-tree-compiler/+bug/1194183

Good to see, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130724/3274e163/attachment.pgp>