hikey: Program serialno only once in flash-all.sh
Change-Id: Ifa0c84ad4ae720f9c75fc487d5eb94ffb3810d00
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
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