summaryrefslogtreecommitdiff
path: root/packages/initscripts/initscripts-1.0/openprotium/flashclean
diff options
context:
space:
mode:
authorAndrew Wilcox <andy@protium.com>2006-12-07 19:43:13 +0000
committerAndrew Wilcox <andy@protium.com>2006-12-07 19:43:13 +0000
commitf68d2c99fa7ca759e2a1e76f856aa59a71bae59f (patch)
tree3bd009b557adc8340b0c599a221dd6a260f0b5ce /packages/initscripts/initscripts-1.0/openprotium/flashclean
parent0165cbef046ef6a02bf096806f2e72d3785358a5 (diff)
initscripts/initscripts-1.0: add openprotium on storcenter specific scripts and bb file.
Diffstat (limited to 'packages/initscripts/initscripts-1.0/openprotium/flashclean')
-rwxr-xr-xpackages/initscripts/initscripts-1.0/openprotium/flashclean60
1 files changed, 60 insertions, 0 deletions
diff --git a/packages/initscripts/initscripts-1.0/openprotium/flashclean b/packages/initscripts/initscripts-1.0/openprotium/flashclean
new file mode 100755
index 0000000000..d9a0e1b592
--- /dev/null
+++ b/packages/initscripts/initscripts-1.0/openprotium/flashclean
@@ -0,0 +1,60 @@
+#! /bin/sh
+#
+# This is an init script for openprotium for storcenter
+#
+# This script cleansup after a successful uboot based reflash.
+# A uboot reflash is done by changing the bootloader boot command
+# to tftp a flash image and flash the firmware. However the boot command
+# is never reset back to a regular boot. This way if the flash did
+# not work the next power cycle will cause another reflash. A nice
+# development recovery feature. So this boot script is the mechanism
+# to reset the uboot boot command. Once booted and access it validated
+# this script will issue command to reset the boot command.
+#
+# This command only has a start so stop is not necessary and should
+# as late in the boot process as possible to ensure a successful reboot
+#
+# Copy it to /etc/init.d/flashclean and type
+# update-rc.d flashclean start 99 5
+#
+BOOTCMD="bootm FF800000"
+
+dmesg | grep StorCenter >/dev/null 2>&1
+if [ $? -ne 0 ]; then
+ exit 0
+fi
+
+printenv=/sbin/fw_printenv
+setenv=/sbin/fw_setenv
+test -x "$printenv" -a -x "$setenv" || exit 0
+
+case "$1" in
+ start)
+ # Check to see if any work needs to be done
+ # Need to quote the right hand side, hence the ugly awk.
+ eval `$printenv bootcmd | awk -F= '{printf("%s=\"%s\"", $1, $2)}'`
+ if [ "$bootcmd" = "$BOOTCMD" ]; then
+ exit 0
+ fi
+
+ echo -n "Restoring u-Boot bootcmd"
+ $setenv bootcmd $BOOTCMD > /dev/null 2>&1
+ eval `$printenv bootcmd | awk -F= '{printf("%s=\"%s\"", $1, $2)}'`
+ if [ "$bootcmd" != "$BOOTCMD" ]; then
+ echo " FAILED."
+ exit 1
+ fi
+ echo "."
+ ;;
+ stop)
+ ;;
+ reload|force-reload)
+ ;;
+ restart)
+ ;;
+ *)
+ echo "Usage: /etc/init.d/flashclean {start|stop|reload|restart|force-reload}"
+ exit 1
+esac
+
+exit 0