hikey: Program serialno only once in flash-all.sh
am: e9b656f63b

Change-Id: I4b2c516b7f2202ae8b3f3a411a089d2e894d76be
diff --git a/installer/flash-all.sh b/installer/flash-all.sh
index 7476db3..0fd401f 100755
--- a/installer/flash-all.sh
+++ b/installer/flash-all.sh
@@ -61,8 +61,16 @@
 echo "android out dir:${OUT_IMGDIR}"
 
 sudo python "${INSTALLER_DIR}"/hisi-idt.py --img1="${FIRMWARE_DIR}"/l-loader.bin -d "${DEVICE_PORT}"
+sleep 3
 # set a unique serial number
-fastboot oem serialno
+serialno=`fastboot getvar serialno 2>&1 > /dev/null`
+if [ "${serialno:10:6}" == "(null)" ]; then
+    fastboot oem serialno
+else
+    if [ "${serialno:10:15}" == "0123456789abcde" ]; then
+        fastboot oem serialno
+    fi
+fi
 fastboot flash ptable "${INSTALLER_DIR}"/"${PTABLE}"
 fastboot flash fastboot "${FIRMWARE_DIR}"/fip.bin
 fastboot flash nvme "${INSTALLER_DIR}"/nvme.img