minnowboard: have provision-device over TCP behave identically to USB
provision-device can be used with no argument if ANDROID_SERIAL is set.
Otherwise the "-s" option can now be used for TCP similarly to USB.
BUG=None
Change-Id: Id021248f791a1ccb9cc769a38898432633a42c58
diff --git a/flash_tools/brillo-flashall.sh b/flash_tools/brillo-flashall.sh
index b89b0b4..4cb0c14 100755
--- a/flash_tools/brillo-flashall.sh
+++ b/flash_tools/brillo-flashall.sh
@@ -36,10 +36,10 @@
LOCAL_DIR=$(dirname "${0}")
BASE_NAME=$(basename "${0}")
-IP="${1}"
-if [ "$IP" == "" ]; then
- echo "Usage: ${BASE_NAME} <MinnowBoard Board IP address>"
- exit 0
+if [ -z $ANDROID_SERIAL ] && [ $# == 0 ]; then
+ echo "Set ANDROID_SERIAL or specify the device with -s option" >&2
+ echo "Usage: ${BASE_NAME} -s tcp:<MinnowBoard IP address>" >&2
+ exit 1
fi
# Location of where the Brillo OS image is built.
@@ -55,22 +55,16 @@
"${ANDROID_BUILD_TOP}/vendor/bsp/intel/minnowboard/boot_binaries")
-if [ -x ./fastboot ]; then
- FASTBOOT=./fastboot
-else
- FASTBOOT=fastboot
-fi
-
-$FASTBOOT -s tcp:$IP flash gpt "${VENDOR}"/gpt.ini
-$FASTBOOT -s tcp:$IP flash bootloader "${VENDOR}"/bootloader
-$FASTBOOT -s tcp:$IP flash boot_a "${OS}"/boot.img
-$FASTBOOT -s tcp:$IP flash boot_b "${OS}"/boot.img
-$FASTBOOT -s tcp:$IP flash system_a "${OS}"/system.img
-$FASTBOOT -s tcp:$IP flash system_b "${OS}"/system.img
-$FASTBOOT -s tcp:$IP flash userdata "${OS}"/userdata.img
-$FASTBOOT -s tcp:$IP flash oemvars "${VENDOR}"/oemvars.txt
-$FASTBOOT -s tcp:$IP oem set_active 0
+fastboot flash gpt "${VENDOR}"/gpt.ini \
+ flash bootloader "${VENDOR}"/bootloader \
+ flash boot_a "${OS}"/boot.img \
+ flash boot_b "${OS}"/boot.img \
+ flash system_a "${OS}"/system.img \
+ flash system_b "${OS}"/system.img \
+ flash userdata "${OS}"/userdata.img \
+ flash oemvars "${VENDOR}"/oemvars.txt \
+ oem set_active 0 "$@"
echo "Please run the following command to restart your MinnowBoard"
-echo " $FASTBOOT -s tcp:$IP reboot"
+echo " fastboot $@ reboot"
echo