From 7c4258145c669cba6e414494de58608a7ef7e3a1 Mon Sep 17 00:00:00 2001 From: computermouth Date: Mon, 28 Nov 2016 17:08:58 -0800 Subject: [PATCH] Add errors for detect nand --- chip-update-firmware.sh | 15 +++++++++++++-- common.sh | 23 ++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/chip-update-firmware.sh b/chip-update-firmware.sh index f33da80..0912fe2 100755 --- a/chip-update-firmware.sh +++ b/chip-update-firmware.sh @@ -8,7 +8,7 @@ IMAGESDIR=".new/firmware/images" DL_URL="http://opensource.nextthing.co/chip/images" -WGET="wget -q --show-progress" +WGET="wget -q" FLAVOR=server BRANCH=stable @@ -168,7 +168,18 @@ echo == preparing images == require_directory "$IMAGESDIR" rm -rf ${IMAGESDIR} require_directory "$DL_DIR" -dl_probe + +##pass +dl_probe || ( + ##fail + echo -e "\n FLASH VERIFICATION FAILED.\n\n" + echo -e "\tTROUBLESHOOTING:\n" + echo -e "\tIs the FEL pin connected to GND?" + echo -e "\tHave you tried turning it off and turning it on again?" + echo -e "\tDid you run the setup script in CHIP-SDK?" + echo -e "\tDownload could be corrupt, it can be re-downloaded by adding the '-f' flag." + echo -e "\n\n" +) ##pass flash_images && ready_to_roll || ( diff --git a/common.sh b/common.sh index a6b998b..fe6faf2 100755 --- a/common.sh +++ b/common.sh @@ -69,6 +69,8 @@ wait_for_fel() { #------------------------------------------------------------ detect_nand() { + local RC=0 + local tmpdir=`mktemp -d -t chip-uboot-script-XXXXXX` local ubootcmds=$tmpdir/uboot.cmds local ubootscr=$tmpdir/uboot.scr @@ -76,35 +78,38 @@ detect_nand() { echo "nand info env export -t -s 0x100 0x7c00 nand_erasesize nand_writesize nand_oobsize reset" > $ubootcmds - mkimage -A arm -T script -C none -n "detect NAND" -d $ubootcmds $ubootscr + mkimage -A arm -T script -C none -n "detect NAND" -d $ubootcmds $ubootscr || RC=1 if ! wait_for_fel; then echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode" + RC=1 exit 1 fi - $FEL spl $IMAGESDIR/sunxi-spl.bin + $FEL spl $IMAGESDIR/sunxi-spl.bin || RC=1 # wait for DRAM initialization to complete sleep 1 - $FEL write $UBOOTMEMADDR $IMAGESDIR/u-boot-dtb.bin - $FEL write $UBOOTSCRMEMADDR $ubootscr - $FEL exe $UBOOTMEMADDR + $FEL write $UBOOTMEMADDR $IMAGESDIR/u-boot-dtb.bin || RC=1 + $FEL write $UBOOTSCRMEMADDR $ubootscr || RC=1 + $FEL exe $UBOOTMEMADDR || RC=1 if ! wait_for_fel; then echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode" exit 1 fi - $FEL read 0x7c00 0x100 $tmpdir/nand-info + $FEL read 0x7c00 0x100 $tmpdir/nand-info || RC=1 echo "NAND detected:" - cat $tmpdir/nand-info + cat $tmpdir/nand-info || RC=1 UBI_TYPE="$(cat $tmpdir/nand-info | awk -F= '/erase/ {print $2}')-$(cat $tmpdir/nand-info | awk -F= '/write/ {print $2}')" - echo "${UBI_TYPE}" > $IMAGESDIR/ubi_type - source $tmpdir/nand-info + echo "${UBI_TYPE}" > $IMAGESDIR/ubi_type || RC=1 + source $tmpdir/nand-info || RC=1 rm -rf $tmpdir + + return $RC } #------------------------------------------------------------