Add in error reporting for UBI flash
This commit is contained in:
parent
983a59dd5f
commit
6b331c4306
@ -93,7 +93,7 @@ function require_directory {
|
||||
}
|
||||
|
||||
function dl_probe {
|
||||
|
||||
|
||||
if [ -z $CACHENUM ]; then
|
||||
CACHENUM=$(curl -s $DL_URL/$BRANCH/$FLAVOR/latest)
|
||||
fi
|
||||
@ -117,7 +117,7 @@ function dl_probe {
|
||||
else
|
||||
echo "== Cached probe files located =="
|
||||
fi
|
||||
|
||||
|
||||
echo "== Staging for NAND probe =="
|
||||
ln -s ../../$DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM}/ $IMAGESDIR
|
||||
if [[ -f ${IMAGESDIR}/ubi_type ]]; then rm ${IMAGESDIR}/ubi_type; fi
|
||||
@ -150,7 +150,7 @@ function dl_probe {
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -f "$DL_DIR/$BRANCH-$FLAVOR-b${CACHENUM}/$UBI_PREFIX-$UBI_TYPE.$UBI_SUFFIX" ]]; then
|
||||
echo "== Downloading new UBI, this will be cached for future flashes. =="
|
||||
pushd $DL_DIR/${BRANCH}-${FLAVOR}-b${CACHENUM} > /dev/null
|
||||
@ -170,6 +170,14 @@ rm -rf ${IMAGESDIR}
|
||||
require_directory "$DL_DIR"
|
||||
dl_probe
|
||||
|
||||
flash_images
|
||||
|
||||
ready_to_roll
|
||||
##pass
|
||||
flash_images && ready_to_roll || (
|
||||
##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"
|
||||
)
|
||||
|
22
common.sh
22
common.sh
@ -109,6 +109,8 @@ reset" > $ubootcmds
|
||||
|
||||
#------------------------------------------------------------
|
||||
flash_images() {
|
||||
local RC=0
|
||||
|
||||
local tmpdir=`mktemp -d -t chip-uboot-script-XXXXXX`
|
||||
local ubootcmds=$tmpdir/uboot.cmds
|
||||
local ubootscr=$tmpdir/uboot.scr
|
||||
@ -122,7 +124,6 @@ flash_images() {
|
||||
echo "nand erase.chip" > $ubootcmds
|
||||
fi
|
||||
|
||||
## echo "env default -a" >> $ubootcmds
|
||||
echo "nand write.raw.noverify $SPLMEMADDR 0x0 $pagespereb" >> $ubootcmds
|
||||
echo "nand write.raw.noverify $SPLMEMADDR 0x400000 $pagespereb" >> $ubootcmds
|
||||
echo "nand write $UBOOTMEMADDR 0x800000 $ubootsize" >> $ubootcmds
|
||||
@ -173,29 +174,32 @@ flash_images() {
|
||||
echo "fastboot 0" >> $ubootcmds
|
||||
echo "reset" >> $ubootcmds
|
||||
|
||||
mkimage -A arm -T script -C none -n "flash $FLAVOR" -d $ubootcmds $ubootscr
|
||||
mkimage -A arm -T script -C none -n "flash $FLAVOR" -d $ubootcmds $ubootscr || RC=1
|
||||
|
||||
if ! wait_for_fel; then
|
||||
echo "ERROR: please make sure CHIP is connected and jumpered in FEL mode"
|
||||
exit 1
|
||||
RC=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/uboot-$nand_erasesize.bin
|
||||
$FEL write $SPLMEMADDR $IMAGESDIR/spl-$nand_erasesize-$nand_writesize-$nand_oobsize.bin
|
||||
$FEL write $UBOOTSCRMEMADDR $ubootscr
|
||||
$FEL exe $UBOOTMEMADDR
|
||||
$FEL write $UBOOTMEMADDR $IMAGESDIR/uboot-$nand_erasesize.bin || RC=1
|
||||
$FEL write $SPLMEMADDR $IMAGESDIR/spl-$nand_erasesize-$nand_writesize-$nand_oobsize.bin || RC=1
|
||||
$FEL write $UBOOTSCRMEMADDR $ubootscr || RC=1
|
||||
$FEL exe $UBOOTMEMADDR || RC=1
|
||||
|
||||
if wait_for_fastboot; then
|
||||
fastboot -i 0x1f3a -u flash UBI $IMAGESDIR/chip-$nand_erasesize-$nand_writesize.ubi.sparse
|
||||
fastboot -i 0x1f3a -u flash UBI $IMAGESDIR/chip-$nand_erasesize-$nand_writesize.ubi.sparse || RC=1
|
||||
else
|
||||
echo "failed to flash the UBI image"
|
||||
RC=1
|
||||
fi
|
||||
|
||||
rm -rf $tmpdir
|
||||
|
||||
return $RC
|
||||
}
|
||||
|
||||
#------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user