My NAND Seems to be Toast

If you find you cannot boot from your NAND, then it's quite like you just need to blank it and reload the kernel, initrd and rootfs back onto it. To do this you will need to have prepared a fresh bootable SD card from the TS website. When you boot off the SD card you should find the following (worked out from the flash7800 script) will restore things for you:

/ # mkdir /dev/mtd
/ # cd /dev/mtd
/dev/mtd # ln -s ../mtd0 0
/dev/mtd # ln -s ../mtd1 1
/dev/mtd # ln -s ../mtd2 2
/dev/mtd # ln -s ../mtd3 3
/dev/mtd # cd /mnt/root
/mnt/root # dd if=7800.mbr of=/dev/mtdblock0
/mnt/root # mtdcopy ImageKernel 1 0
/mnt/root # mtdcopy 7800initrd 2 0
/mnt/root # eraseall /dev/mtd3
/mnt/root # mkdir tmp
/mnt/root # mount /dev/mtd3 tmp
/mnt/root # cd tmp
/mnt/root/tmp # tar -xzf ../sarge-7800.tar.gz
/mnt/root/tmp # md5sum -c ../files.md5
/mnt/root/tmp # cd ..
/mnt/root # umount tmp
/mnt/root # cd ..
/mnt # umount root

It's REALLY Poouched

Sometimes you might see the following worrying error instead:

>> TS-BOOTROM - built Nov 27 2007
>> Copyright (c) 2007, Technologic Systems
>> Booting from onboard NAND flash...
!0000049a>> flash ECC error!

This implies that even the chunk at the beginning of your NAND is toast (well the ECC at least) then you need to blat the whole thing:

eraseall /dev/mtd0

Seemed to work for me, then you follow the usual 'restore NAND' destructions above.