summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2017-09-15 11:00:54 -0500
committerJohn Klug <john.klug@multitech.com>2017-09-20 11:26:08 -0500
commit8dbc08a6f98fba1f61a8505791e0682112420302 (patch)
tree751715d597387b0e852ae7bbc4d3839ccf16a3db
parentacac04936c685b0891261ed81692260e2afdf346 (diff)
downloadmeta-mlinux-8dbc08a6f98fba1f61a8505791e0682112420302.tar.gz
meta-mlinux-8dbc08a6f98fba1f61a8505791e0682112420302.tar.bz2
meta-mlinux-8dbc08a6f98fba1f61a8505791e0682112420302.zip
Do not do flash upgrade when /var/volatile is full, and blink LEDS
-rw-r--r--recipes-core/initscripts/initscripts-1.0/umountfs39
1 files changed, 37 insertions, 2 deletions
diff --git a/recipes-core/initscripts/initscripts-1.0/umountfs b/recipes-core/initscripts/initscripts-1.0/umountfs
index 8c12ebe..f371554 100644
--- a/recipes-core/initscripts/initscripts-1.0/umountfs
+++ b/recipes-core/initscripts/initscripts-1.0/umountfs
@@ -49,6 +49,33 @@ blink_leds() {
done
}
+err_leds() {
+ led_dir=/sys/class/leds
+ # blink all programmable LEDs except status
+ leds=$(ls $led_dir/ | grep -v status)
+ nleds=$(echo "$leds" | wc -w)
+
+ # turn LEDs off
+ for led in $leds; do
+ echo "timer" > $led_dir/$led/trigger
+ echo 0 > $led_dir/$led/delay_off
+ done
+
+ int=200
+ total=$(( int * (nleds+1) ))
+ on=$(( total - int ))
+ off=$(( total - on ))
+
+ # make a pattern
+ for led in $leds; do
+ echo "$on" > $led_dir/$led/delay_on
+ echo "$off" > $led_dir/$led/delay_off
+ done
+ sleep 5
+}
+
+
+
flash_upgrade() {
if [ $# -ne 1 ]; then
echo "need to specify flash-root"
@@ -188,8 +215,16 @@ flash_upgrade() {
blink_leds
- cp ${reboot_cmd} ${flash_dir}/upgrade-reboot
- cp ${nandwrite_cmd} ${flash_dir}/nandwrite.static
+ if ! cp ${reboot_cmd} ${flash_dir}/upgrade-reboot ; then
+ echo "Aborting upgrade. Failed \"cp ${reboot_cmd} ${flash_dir}/upgrade-reboot\""
+ err_leds
+ return 1
+ fi
+ if ! cp ${nandwrite_cmd} ${flash_dir}/nandwrite.static ; then
+ echo "Aborting upgrade. Failed \"cp ${nandwrite_cmd} ${flash_dir}/nandwrite.static\""
+ err_leds
+ return 1
+ fi
sync
sleep 2
mount -o remount,ro ${flash_root}