
Hello. let me introduce myself.
I'm low-level developer working on AROS (AROS Research Operating System, http://www.aros.org/). Currently I'm working for Genesi company where I'm responsible for e.g. UBoot port for the EfikaMX Smarttop and smartbook ARM-based machines. See http://www.genesi-usa.com/products%C2%A0for more details.
Working on the UBoot for EfikaMX I found out, that the minimalistic shell is not able to compare two strings. Therefore I have added a new uboot command, strcmp, which takes three arguments - two strings to compare and the compare operator. The function can be used in combination with "if" command as follows:
if strcmp foo <= bar; then .......; fi
The allowed operators are ==, !=, <, <=, >, >=. The two strings are compared up to the length of shorter one, different size does not count to the comparison. This feature is used in script which performs automatic update of uboot only if there is a newer version available. In order to do that I have defined a timestamp variable:
$(TIMESTAMP_FILE): @date +'#define U_BOOT_DATE "%b %d %C%y"' > $@ @date +'#define U_BOOT_TIME "%T"' >> $@ @date +'#define U_BOOT_TIMESTAMP "%Y%m%d%H%M%S"' >> $@
where U_BOOT_TIMESTAMP is available as environment variable $firmware_version. Thanks to the partial comparison, I can use following statement in my script:
if strcmp ${firmware_version} < 20101001; then .....; fi;
Here, commands will be executed if firmware timestamp is older than October, 1st, 2010.
Could this strcmp command be useful for anyone else? If so, I would be pleased to add it to the main uboot repository.
With best regards, Michal Schulz.
-- Michal Schulz