diff options
Diffstat (limited to 'contrib/SD/root/home/mtadm/install.sh')
-rwxr-xr-x | contrib/SD/root/home/mtadm/install.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/SD/root/home/mtadm/install.sh b/contrib/SD/root/home/mtadm/install.sh new file mode 100755 index 0000000..0d3442b --- /dev/null +++ b/contrib/SD/root/home/mtadm/install.sh @@ -0,0 +1,48 @@ +#!/bin/bash +fail=0 +function verify +{ + dev=$1 + file=$2 + tfile=$(mktemp -tp /tmp md5sum.XXXXXX) + + count=$(stat -Lc %s $file) + cat $file | md5sum >$tfile + echo "Check device $dev $file against file $tfile for $count bytes" + echo + if nanddump -l $count $dev | md5sum -c $tfile ; then + echo "File $2 verified" + else + echo "File $2 fails on NAND check" + ((++fail)) + exit 1 + fi +} +if (($# < 1)) || ! [[ -d $1 ]] ; then + echo "Did not find a directory" + echo "Possibly one of $(find /images -type d)" + exit 1 +fi +cd $1 +set -e +flash_erase /dev/mtd1 0 0 +nandwrite -p /dev/mtd1 bstrap.bin +verify /dev/mtd1 bstrap.bin +flash_erase /dev/mtd2 0 0 +nandwrite -p /dev/mtd2 uboot.bin +verify /dev/mtd2 uboot.bin +flash_erase /dev/mtd3 0 0 +flash_erase /dev/mtd4 0 0 +flash_erase /dev/mtd5 0 0 +nandwrite -p /dev/mtd5 uImage.bin +verify /dev/mtd5 uImage.bin +flash_erase -j /dev/mtd6 0 0 +flash_erase -j /dev/mtd7 0 0 +flash_erase -j /dev/mtd8 0 0 +nandwrite -p /dev/mtd8 rootfs.jffs2 +verify /dev/mtd8 rootfs.jffs2 +flash_erase -j /dev/mtd9 0 0 +if ((fail > 0)) ; then + echo "ERROR: One or more failures writing NAND" + echo "Check log" +fi |