diff options
author | Scott Anderson <saa@google.com> | 2011-11-30 18:50:11 -0800 |
---|---|---|
committer | Mike J. Chen <mjchen@google.com> | 2012-03-03 17:29:31 -0800 |
commit | a0c08151b180a77c1e2dbf37729f9a4c8b0d9a03 (patch) | |
tree | f0251ee835e0c1c4bf14557fdc23fff3664fe3b4 | |
parent | 9aae3d112d40a10d67e2097f85e2ab7e54a0ff3a (diff) | |
download | uboot-a0c08151b180a77c1e2dbf37729f9a4c8b0d9a03.tar.gz |
FASTBOOT: Allow fastboot version to be auto-generated
If neither BUILD_TAG nor CONFIG_FASTBOOT_VERSION_BOOTLOADER is
defined, CONFIG_FASTBOOT_VERSION_BOOTLOADER will be automatically
defined. From comments in this change:
* ... the form:
* productnameYMDHB
* where:
* productname is FASTBOOT_PRODUCT_NAME
* Y is the year with 'A' being 2011 and incrementing from there
* M is the month
* D is the day of the month
* H is the hour
* B is the minute divided by two
* All of the fields are based upon the build time. M, D, H and B are all
* output in base 36 (i.e. each digit is in the set 0-9A-Z).
Change-Id: I3f0aee314e4eea35b9fe7a705df42984c8725cde
Signed-off-by: Scott Anderson <saa@google.com>
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | common/cmd_fastboot.c | 27 | ||||
-rw-r--r-- | include/fastboot.h | 1 |
3 files changed, 31 insertions, 3 deletions
@@ -456,6 +456,12 @@ $(obj)spl/u-boot-spl.bin: depend $(TIMESTAMP_FILE): @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@ @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@ +ifeq ($(CONFIG_FASTBOOT),y) + @eval `date +'BYR=%Y BMON=%-m BDOM=%-d BHR=%-H BMIN=%-M'`; \ + chr () { printf \\$$(($$1/64*100+$$1%64/8*10+$$1%8)); }; \ + b36 () { if [ $$1 -le 9 ]; then echo $$1; else chr $$((0x41 + $$1 - 10)); fi }; \ + printf '#define FASTBOOT_TIMESTAMP "%c%c%c%c%c"\n' `chr $$((0x41 + $$BYR - 2011))` `b36 $$BMON` `b36 $$BDOM` `b36 $$BHR` `b36 $$(($$BMIN/2))` >> $@ +endif updater: $(MAKE) -C tools/updater all diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c index b91dbaa81..b77ad6033 100644 --- a/common/cmd_fastboot.c +++ b/common/cmd_fastboot.c @@ -68,14 +68,37 @@ DECLARE_GLOBAL_DATA_PTR; /* If a BUILD_TAG was passed as an argument to make, use it * for the fastboot version. Otherwise, see if a board file * defined a CONFIG_FASTBOOT_VERSION_BOOTLOADER and if so, use - * that. Otherwise, use the FASTBOOT_VERSION protocol id. + * that. Otherwise, use an automatically constructed one of the form: + * productnameYMDHB + * where: + * productname is FASTBOOT_PRODUCT_NAME + * Y is the year with 'A' being 2011 and incrementing from there + * M is the month + * D is the day of the month + * H is the hour + * B is the minute divided by two + * All of the fields are based upon the build time. M, D, H and B are all + * output in base 36 (i.e. each digit is in the set 0-9A-Z). A quick and + * dirty Python program to convert one of these versions back to the build + * time: + +#! /usr/bin/env python +import sys +foo = sys.argv[1][-5:] +print "%04d/%02d/%02d %02d:%02d\n" % (int(foo[0], 36) + 2001, + int(foo[1], 36), + int(foo[2], 36), + int(foo[3], 36), + int(foo[4], 36) * 2) */ #ifdef BUILD_TAG #undef CONFIG_FASTBOOT_VERSION_BOOTLOADER #define CONFIG_FASTBOOT_VERSION_BOOTLOADER BUILD_TAG #else #ifndef CONFIG_FASTBOOT_VERSION_BOOTLOADER -#define CONFIG_FASTBOOT_VERSION_BOOTLOADER FASTBOOT_VERSION +#include <timestamp_autogenerated.h> +#define CONFIG_FASTBOOT_VERSION_BOOTLOADER \ + (FASTBOOT_PRODUCT_NAME FASTBOOT_TIMESTAMP) #endif #endif diff --git a/include/fastboot.h b/include/fastboot.h index d4b005f4d..c8dba3592 100644 --- a/include/fastboot.h +++ b/include/fastboot.h @@ -81,7 +81,6 @@ #define FASTBOOT_INTERFACE_SUB_CLASS 0x42 #define FASTBOOT_INTERFACE_PROTOCOL 0x03 -#define FASTBOOT_VERSION "0.5" #define FASTBOOT_SERIALNO_BOOTARG "androidboot.serialno" /* The fastboot client uses a value of 2048 for the |