From patchwork Wed Jul 24 17:09:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 261469 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3D31C2C007C for ; Thu, 25 Jul 2013 03:09:54 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CF2BD4A0A6; Wed, 24 Jul 2013 19:09:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2+Q6KGUBagsU; Wed, 24 Jul 2013 19:09:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8A6954A044; Wed, 24 Jul 2013 19:09:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92FBB4A053 for ; Wed, 24 Jul 2013 19:09:40 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O3rvy4MdFJ3v for ; Wed, 24 Jul 2013 19:09:36 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from avon.wwwdotorg.org (avon.wwwdotorg.org [70.85.31.133]) by theia.denx.de (Postfix) with ESMTPS id 4F3724A03A for ; Wed, 24 Jul 2013 19:09:34 +0200 (CEST) Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 72953631E; Wed, 24 Jul 2013 11:09:33 -0600 (MDT) Received: from dart.wwwdotorg.org.com (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id BC8FBE4798; Wed, 24 Jul 2013 11:09:32 -0600 (MDT) From: Stephen Warren To: Tom Rini Date: Wed, 24 Jul 2013 10:09:16 -0700 Message-Id: <1374685764-4828-2-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1374685764-4828-1-git-send-email-swarren@wwwdotorg.org> References: <1374685764-4828-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.97.7 at avon.wwwdotorg.org X-Virus-Status: Clean Cc: u-boot@lists.denx.de, Stephen Warren Subject: [U-Boot] [PATCH V2 REPOST 1/9] Validate dtc is new enough X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Stephen Warren 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. Signed-off-by: Stephen Warren Acked-by: Simon Glass --- 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 diff --git a/Makefile b/Makefile index 4218226..1cb9203 100644 --- a/Makefile +++ b/Makefile @@ -429,7 +429,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 $@ @@ -683,6 +683,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) # diff --git a/config.mk b/config.mk index e21d698..efb70a6 100644 --- a/config.mk +++ b/config.mk @@ -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...) diff --git a/tools/dtc-version.sh b/tools/dtc-version.sh new file mode 100755 index 0000000..e8c94d3 --- /dev/null +++ b/tools/dtc-version.sh @@ -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 \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