From: Tom Rini <trini@konsulko.com>
Date: Sat, 23 Sep 2017 17:00:57 +0000 (-0400)
Subject: dtc: Switch to building and using our own dtc unless provided
X-Git-Tag: v2025.01-rc5-pxa1908~5708
X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-logo.png?a=commitdiff_plain;h=36dd5f1b8abc;p=u-boot.git

dtc: Switch to building and using our own dtc unless provided

This makes us act like the Linux Kernel does and allow for dtc to be
provided externally but otherwise we use the version of dtc that is
included in the sources.  This in turn means that we can drop the
checkdtc logic.  We select DTC in the cases where we will need the dtc
tool provided.

Signed-off-by: Tom Rini <trini@konsulko.com>
---

diff --git a/.travis.yml b/.travis.yml
index 9dfd016da0..00b2a73a5e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,11 +26,9 @@ addons:
     - grub-efi-ia32-bin
     - rpm2cpio
     - wget
+    - device-tree-compiler
 
 install:
- # install latest device tree compiler
- - git clone --depth=1 -b v1.4.3 git://git.kernel.org/pub/scm/utils/dtc/dtc.git /tmp/dtc
- - make -j4 -C /tmp/dtc
  # Clone uboot-test-hooks
  - git clone --depth=1 git://github.com/swarren/uboot-test-hooks.git /tmp/uboot-test-hooks
  - ln -s travis-ci /tmp/uboot-test-hooks/bin/`hostname`
@@ -51,7 +49,7 @@ install:
 
 env:
   global:
-    - PATH=/tmp/dtc:/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
+    - PATH=/tmp/qemu-install/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin
     - PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
     - BUILD_DIR=build
     - HOSTCC="cc"
diff --git a/Makefile b/Makefile
index e058e9854b..b7d5cbb3f9 100644
--- a/Makefile
+++ b/Makefile
@@ -349,7 +349,7 @@ OBJDUMP		= $(CROSS_COMPILE)objdump
 AWK		= awk
 PERL		= perl
 PYTHON		?= python
-DTC		?= dtc
+DTC		?= $(objtree)/scripts/dtc/dtc
 CHECK		= sparse
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
@@ -872,7 +872,7 @@ endif
 PHONY += dtbs
 dtbs: dts/dt.dtb
 	@:
-dts/dt.dtb: checkdtc u-boot
+dts/dt.dtb: u-boot
 	$(Q)$(MAKE) $(build)=dts dtbs
 
 quiet_cmd_copy = COPY    $@
@@ -1447,12 +1447,6 @@ SYSTEM_MAP = \
 System.map:	u-boot
 		@$(call SYSTEM_MAP,$<) > $@
 
-checkdtc:
-	@if test $(call dtc-version) -lt 010403; then \
-		echo '*** Your dtc is too old, please upgrade to dtc 1.4.3 or newer'; \
-		false; \
-	fi
-
 #########################################################################
 
 # ARM relocations should all be R_ARM_RELATIVE (32-bit) or
diff --git a/dts/Kconfig b/dts/Kconfig
index b4b7ddc144..44fc9fe36d 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -5,11 +5,15 @@
 config SUPPORT_OF_CONTROL
 	bool
 
+config DTC
+	bool
+
 menu "Device Tree Control"
 	depends on SUPPORT_OF_CONTROL
 
 config OF_CONTROL
 	bool "Run-time configuration via Device Tree"
+	select DTC
 	help
 	  This feature provides for run-time configuration of U-Boot
 	  via a flattened device tree.
diff --git a/scripts/Makefile b/scripts/Makefile
index 3e10c16d59..9d55241463 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -21,3 +21,4 @@ build_docproc: $(obj)/docproc
 
 # Let clean descend into subdirs
 subdir-	+= basic kconfig
+subdir-$(CONFIG_DTC)	+= dtc