flash: Fix a duplicate early check

We were previously trying to check to see if ${PART_IMAGE} was around before we
defined its contents. It was harmless, but silly. This moves the bootloader
flashing below the definition and the check so that we don't accidentally flash
the bootloader before we check to see if we have a gpt.

Change-Id: Ia00222e4b71b3448d26bb846b6d6c67544793ae2
diff --git a/flash.sh b/flash.sh
index 8bec239..5a35b56 100755
--- a/flash.sh
+++ b/flash.sh
@@ -45,14 +45,10 @@
     fi
 }
 
-for i in u-boot.imx ${PART_IMAGE} boot_${USERSPACE_ARCH}.img rootfs_${USERSPACE_ARCH}.img; do
+for i in u-boot.imx boot_${USERSPACE_ARCH}.img rootfs_${USERSPACE_ARCH}.img; do
     [[ ! -f ${PRODUCT_OUT}/$i ]] && die "${PRODUCT_OUT}/$i is missing."
 done
 
-# Flash bootloader
-${FASTBOOT_CMD} flash bootloader0 ${PRODUCT_OUT}/u-boot.imx
-${FASTBOOT_CMD} reboot-bootloader
-
 # Figure out which partition map we need based upon fastboot vars
 MMC_SIZE=$(${FASTBOOT_CMD} getvar mmc_size 2>&1 | awk '/mmc_size:/ { print $2 }')
 PART_IMAGE=$(partition_table_image ${MMC_SIZE})
@@ -62,6 +58,10 @@
     exit 1
 fi
 
+# Flash bootloader
+${FASTBOOT_CMD} flash bootloader0 ${PRODUCT_OUT}/u-boot.imx
+${FASTBOOT_CMD} reboot-bootloader
+
 # Flash partition table
 ${FASTBOOT_CMD} flash gpt ${PRODUCT_OUT}/${PART_IMAGE}
 ${FASTBOOT_CMD} reboot-bootloader