flash-all.sh: support for case that not run lunch

In the cases that we build in a script or built several days before,
we don't want to run "lunch hikey-userdebug" before run flash-all.sh

ANDROID_BUILD_TOP will be only availbe after run lunch command

Change-Id: I06c9479cd05a5178b6d1444eedbc67d743db28ae
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/installer/flash-all.sh b/installer/flash-all.sh
index 7cf4775..2c3365c 100755
--- a/installer/flash-all.sh
+++ b/installer/flash-all.sh
@@ -23,6 +23,12 @@
 INSTALLER_DIR="`dirname ${0}`"
 FIRMWARE_DIR="${INSTALLER_DIR}"
 
+# for cases that not run "lunch hikey-userdebu"
+if [ -z "${ANDROID_BUILD_TOP}" ]; then
+    ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../
+    ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey"
+fi
+
 if [ -z "${DIST_DIR}" ]; then
     DIST_DIR="${ANDROID_BUILD_TOP}"/out/dist
 fi