3 # This is an init script for openprotium for storcenter
5 # This script cleansup after a successful uboot based reflash.
6 # A uboot reflash is done by changing the bootloader boot command
7 # to tftp a flash image and flash the firmware. However the boot command
8 # is never reset back to a regular boot. This way if the flash did
9 # not work the next power cycle will cause another reflash. A nice
10 # development recovery feature. So this boot script is the mechanism
11 # to reset the uboot boot command. Once booted and access it validated
12 # this script will issue command to reset the boot command.
14 # This command only has a start so stop is not necessary and should
15 # as late in the boot process as possible to ensure a successful reboot
17 # Copy it to /etc/init.d/flashclean and type
18 # update-rc.d flashclean start 99 5
20 BOOTCMD
="bootm FF800000"
22 dmesg |
grep StorCenter
>/dev
/null
2>&1
27 printenv=/sbin
/fw_printenv
28 setenv
=/sbin
/fw_setenv
29 test -x "$printenv" -a -x "$setenv" ||
exit 0
33 # Check to see if any work needs to be done
34 # Need to quote the right hand side, hence the ugly awk.
35 eval `$printenv bootcmd | awk -F= '{printf("%s=\"%s\"", $1, $2)}'`
36 if [ "$bootcmd" = "$BOOTCMD" ]; then
40 echo -n "Restoring u-Boot bootcmd"
41 $setenv bootcmd
$BOOTCMD > /dev
/null
2>&1
42 eval `$printenv bootcmd | awk -F= '{printf("%s=\"%s\"", $1, $2)}'`
43 if [ "$bootcmd" != "$BOOTCMD" ]; then
56 echo "Usage: /etc/init.d/flashclean {start|stop|reload|restart|force-reload}"