Browse Source

Add errors for detect nand

chip/stable
computermouth 6 years ago
parent
commit
7c4258145c
  1. 15
      chip-update-firmware.sh
  2. 23
      common.sh

15
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 || (

23
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
}
#------------------------------------------------------------

Loading…
Cancel
Save