[U-Boot] [PATCH V2 1/9] Validate dtc is new enough
Stephen Warren
swarren at wwwdotorg.org
Tue Jun 25 20:07:21 CEST 2013
On 06/25/2013 11:22 AM, Gerhard Sittig wrote:
> On Mon, Jun 24, 2013 at 09:43 -0600, Stephen Warren wrote:
>>
>> +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 ...
>
>> --- /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
>> +#
>
> 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?
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
More information about the U-Boot
mailing list