Export/unset of environment variables related to usb state

This commit is contained in:
howie 2017-07-25 17:43:54 -07:00
parent c69af92cce
commit 2c2259f6a8
1 changed files with 12 additions and 4 deletions

View File

@ -44,9 +44,11 @@ filesize() {
#------------------------------------------------------------
wait_for_fastboot() {
echo -n "waiting for fastboot...";
export FLASH_WAITING_FOR_DEVICE=1
for ((i=$TIMEOUT; i>0; i--)) {
if [[ ! -z "$(${FASTBOOT} -i 0x1f3a $@ devices)" ]]; then
echo "OK";
unset FLASH_WAITING_FOR_DEVICE
return 0;
fi
echo -n ".";
@ -54,15 +56,18 @@ wait_for_fastboot() {
}
echo "TIMEOUT";
unset FLASH_WAITING_FOR_DEVICE
return 1
}
#------------------------------------------------------------
wait_for_fel() {
echo -n "waiting for fel...";
export FLASH_WAITING_FOR_DEVICE=1
for ((i=$TIMEOUT; i>0; i--)) {
if ${FEL} $@ ver 2>/dev/null >/dev/null; then
echo "OK"
unset FLASH_WAITING_FOR_DEVICE
return 0;
fi
echo -n ".";
@ -70,6 +75,7 @@ wait_for_fel() {
}
echo "TIMEOUT";
unset FLASH_WAITING_FOR_DEVICE
return 1
}
@ -196,6 +202,7 @@ flash_images() {
${MKIMAGE} -A arm -T script -C none -n "flash $FLAVOR" -d $ubootcmds $ubootscr || RC=1
export FLASH_VID_PID=1f3aefe8
if ! wait_for_fel; then
echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode"
RC=1
@ -210,6 +217,7 @@ flash_images() {
$FEL write $UBOOTSCRMEMADDR $ubootscr || RC=1
$FEL exe $UBOOTMEMADDR || RC=1
export FLASH_VID_PID=1f3a1010
if wait_for_fastboot; then
${FASTBOOT} -i 0x1f3a -u flash UBI $IMAGESDIR/chip-$nand_erasesize-$nand_writesize-$nand_oobsize.ubi.sparse || RC=1
${FASTBOOT} -i 0x1f3a continue > /dev/null