root/trunk/software/rootfs/flash.sh

Revision 345, 1.1 kB (checked in by hardert, 5 months ago)

Fix error trapping and output warnings/success messages that fit the
OSWALD's small terminal size

  • Property svn:executable set to *
Line 
1 #!/bin/sh
2 #
3 # This script flashes the NAND parition for the root filesystem on the OSWALD
4 # with a bzipped tarball of a root filesystem found on the second partition of
5 # the inserted SD card in the root directory.
6
7 # Exit if any command exits with a non-zero status
8 set -o errexit
9
10 trap errorhandler 0 1 2 3 15
11
12 errorhandler() {
13         echo -e "\n"
14         echo "WARNING: An error may have occurred while flashing"
15         echo "the NAND with the new root filesystem. The SD card"
16         echo "may be bad if the untarring process segfaulted or"
17         echo "the system might not have tar installed with bzip2"
18         echo "support if the process never started."
19         if [ -n "$(grep /media/nand /proc/mounts)" ] ; then
20                 umount /media/nand
21         fi
22         exit 1
23 }
24
25 flash_eraseall -j /dev/mtd4
26 [ -d /media/nand ] || mkdir /media/nand
27 mount -t jffs2 /dev/mtdblock4 /media/nand
28 tar jxvf /media/mmcblk0p2/rootfs.tar.bz2 -C /media/nand
29 umount /media/nand
30 echo "default-on" > /sys/class/leds/oswaldboard\:\:usr/trigger
31 echo "SUCCESS: The device has been flashed with a new"
32 echo "root filesystem. The SD card should now be "
33 echo "removed before turning off the device."
Note: See TracBrowser for help on using the browser.