Patchwork [U-Boot,V2,REPOST,1/9] Validate dtc is new enough

login
register
mail settings
Submitter Stephen Warren
Date July 24, 2013, 5:09 p.m.
Message ID <1374685764-4828-2-git-send-email-swarren@wwwdotorg.org>
Download mbox | patch
Permalink /patch/261469/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Stephen Warren - July 24, 2013, 5:09 p.m.
From: Stephen Warren <swarren@nvidia.com>

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 <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
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
Stephen Warren - Aug. 2, 2013, 10:23 p.m.
On 07/24/2013 11:09 AM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
> 
> 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.

Tom, do these patches look good?
Tom Rini - Aug. 3, 2013, 12:32 a.m.
On Fri, Aug 02, 2013 at 04:23:37PM -0600, Stephen Warren wrote:
> On 07/24/2013 11:09 AM, Stephen Warren wrote:
> > From: Stephen Warren <swarren@nvidia.com>
> > 
> > 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.
> 
> Tom, do these patches look good?

So, Albert, Tom W, are we OK with some machines (say the 'tegra' SoCs
for example) not building on some distros, until / unless the developer
updates their dtc package?
Albert ARIBAUD - Aug. 3, 2013, 2:11 p.m.
Hi Tom,

On Fri, 2 Aug 2013 20:32:03 -0400, Tom Rini <trini@ti.com> wrote:

> On Fri, Aug 02, 2013 at 04:23:37PM -0600, Stephen Warren wrote:
> > On 07/24/2013 11:09 AM, Stephen Warren wrote:
> > > From: Stephen Warren <swarren@nvidia.com>
> > > 
> > > 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.
> > 
> > Tom, do these patches look good?
> 
> So, Albert, Tom W, are we OK with some machines (say the 'tegra' SoCs
> for example) not building on some distros, until / unless the developer
> updates their dtc package?

I am fine with this as long as this is documented.

Amicalement,
Tom Rini - Aug. 3, 2013, 3:31 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/03/2013 10:11 AM, Albert ARIBAUD wrote:
> Hi Tom,
> 
> On Fri, 2 Aug 2013 20:32:03 -0400, Tom Rini <trini@ti.com> wrote:
> 
>> On Fri, Aug 02, 2013 at 04:23:37PM -0600, Stephen Warren wrote:
>>> On 07/24/2013 11:09 AM, Stephen Warren wrote:
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>> 
>>>> 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.
>>> 
>>> Tom, do these patches look good?
>> 
>> So, Albert, Tom W, are we OK with some machines (say the 'tegra' 
>> SoCs for example) not building on some distros, until / unless 
>> the developer updates their dtc package?
> 
> I am fine with this as long as this is documented.

Yes, the error produced is clear: "Your dtc is too old, please upgrade
to dtc 1.4 or newer".

I shall push this shortly, thanks!

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJR/SJLAAoJENk4IS6UOR1WOvcP/31CCKPWepv6yxGWjWm3UO1/
ZC/0EB1y+3UkL+1pFYe2LuTDob3TjJQxKohlG3WWKH4NJ7Vcp29g364WJPkZYT+8
Lg438WS/kkgowpXkIreHNerLE0HKp19CsoBkS78Zci1rUSeUGuVSBg7SKCvrvLK8
3RBgTN5nx5/cTEU9D9DQINSb8P1bhSidoqov8npHULObVK6fo96wRqX5cW9401vU
EhwjeAsjcdcbj4Nrgp3jAalZWu+EfwZeykfixbBUyP5pTKjDs4kLIzDpNbpFefDg
xYWNNVPQ9DNJXK5kVojgwAyJuCzg77PNQfvREnUSvrAbKUJRY0SXiGYgQl8dpgdw
lphSiU7R2yp4o3MVMU+T7uZKMlpz8rz/wqFIJxgoXL2vVvHvzDolnx0ymON6NPZ/
NL7evKtD4GADm5mUZc4JvRoOCZwOZRjC8dvDD0SoanzhSOk5rwBN8XdyC8yropu4
7hND7xdRc0i1ivRlqWZY8Mnj4URdhDeXufZp1DwIpNkyctSyTLUohJ8M/q4DBMyl
2FwlL3hauHPWJTL9Hs6tDxCSYgGCB2dQzpi9jzoISEqkVkq7ZDcDIbRN8itKwVrD
jacFIHAiqTUaOSfsb2kVGrNXRqKlyZelxu7hFi1J17Lhq1Hxl7b3ZQX0DBps/kmg
z4pdAcisRZqLlK3HGJ1h
=/6Du
-----END PGP SIGNATURE-----

Patch

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 <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