am ce053677: am f26eb51c: Merge "Add "fastboot --version"."

* commit 'ce05367734fabef8409e9d6c6c57f5ba522a96c5':
  Add "fastboot --version".
This commit is contained in:
Elliott Hughes 2015-06-03 02:57:28 +00:00 committed by Android Git Automerger
commit bd8771077c
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 -Wunreachable-code
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

@ -964,8 +964,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}
};
@ -1037,6 +1038,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: