diff options
author | John Klug <john.klug@multitech.com> | 2017-09-15 11:00:54 -0500 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2017-09-15 11:00:54 -0500 |
commit | d87470d80189b99a6be20fec1092e8110fe8805d (patch) | |
tree | 50c9f678baca89801f329e8e682cdbef3cd68d1f /recipes-core/initscripts | |
parent | 3376dd9b98a0cc52e97d528370ac9ad3ad8fa9c7 (diff) | |
download | meta-mlinux-d87470d80189b99a6be20fec1092e8110fe8805d.tar.gz meta-mlinux-d87470d80189b99a6be20fec1092e8110fe8805d.tar.bz2 meta-mlinux-d87470d80189b99a6be20fec1092e8110fe8805d.zip |
Do not do flash upgrade when /var/volatile is full, and blink LEDS
Diffstat (limited to 'recipes-core/initscripts')
-rw-r--r-- | recipes-core/initscripts/initscripts-1.0/umountfs | 39 |
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 bfd4d47..c782dc7 100644 --- a/recipes-core/initscripts/initscripts-1.0/umountfs +++ b/recipes-core/initscripts/initscripts-1.0/umountfs @@ -50,6 +50,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" @@ -189,8 +216,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} |