Add "fastboot --version".

So bug reporters can actually tell us what they're running.

Bug: http://b/21583225
Change-Id: If2a4ae97b4792aa321566603ce2c354a72d32307
This commit is contained in:
Elliott Hughes 2015-06-02 13:50:00 -07:00
parent 1333694c85
commit 379646b2ca
2 changed files with 11 additions and 4 deletions

View File

@ -14,6 +14,8 @@
LOCAL_PATH:= $(call my-dir)
fastboot_version := $(shell git -C $(LOCAL_PATH) rev-parse --short=12 HEAD 2>/dev/null)-android
include $(CLEAR_VARS)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
@ -25,14 +27,15 @@ LOCAL_MODULE_TAGS := debug
LOCAL_CONLYFLAGS += -std=gnu99
LOCAL_CFLAGS += -Wall -Wextra -Werror
LOCAL_CFLAGS += -DFASTBOOT_REVISION='"$(fastboot_version)"'
ifeq ($(HOST_OS),linux)
LOCAL_SRC_FILES += usb_linux.c util_linux.c
endif
ifeq ($(HOST_OS),darwin)
LOCAL_SRC_FILES += usb_osx.c util_osx.c
LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit \
-framework Carbon
LOCAL_LDLIBS += -lpthread -framework CoreFoundation -framework IOKit -framework Carbon
LOCAL_CFLAGS += -Wno-unused-parameter
endif

View File

@ -971,8 +971,9 @@ int main(int argc, char **argv)
{"page_size", required_argument, 0, 'n'},
{"ramdisk_offset", required_argument, 0, 'r'},
{"tags_offset", required_argument, 0, 't'},
{"help", 0, 0, 'h'},
{"unbuffered", 0, 0, 0},
{"help", no_argument, 0, 'h'},
{"unbuffered", no_argument, 0, 0},
{"version", no_argument, 0, 0},
{0, 0, 0, 0}
};
@ -1044,6 +1045,9 @@ int main(int argc, char **argv)
if (strcmp("unbuffered", longopts[longindex].name) == 0) {
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
} else if (strcmp("version", longopts[longindex].name) == 0) {
fprintf(stdout, "fastboot version %s\n", FASTBOOT_REVISION);
return 0;
}
break;
default: