mvebu: add sysupgrade support for clearfog
[openwrt/openwrt.git] / target / linux / mvebu / base-files / lib / upgrade / linksys.sh
index f37831b..baa29dc 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# Copyright (C) 2014 OpenWrt.org
+# Copyright (C) 2014-2015 OpenWrt.org
 #
 
 linksys_get_target_firmware() {
 #
 
 linksys_get_target_firmware() {
@@ -19,6 +19,9 @@ linksys_get_target_firmware() {
                fw_setenv bootcmd "run nandboot"
        fi
 
                fw_setenv bootcmd "run nandboot"
        fi
 
+       # re-enable recovery so we get back if the new firmware is broken
+       fw_setenv auto_recovery yes
+
        echo "$target_firmware"
 }
 
        echo "$target_firmware"
 }
 
@@ -71,13 +74,18 @@ platform_do_upgrade_linksys() {
 }
 
 linksys_preupgrade() {
 }
 
 linksys_preupgrade() {
-       export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
-       export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
-       export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
+       local board=$(mvebu_board_name)
 
 
-       [ -f /tmp/sysupgrade.tgz ] && {
-               cp /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
-       }
+       case "$board" in
+       armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|armada-xp-linksys-mamba)
+               export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /usr/sbin/fw_printenv /usr/sbin/fw_setenv"
+               export RAMFS_COPY_BIN="${RAMFS_COPY_BIN} /bin/mkdir /bin/touch"
+               export RAMFS_COPY_DATA="${RAMFS_COPY_DATA} /etc/fw_env.config /var/lock/fw_printenv.lock"
+
+               [ -f /tmp/sysupgrade.tgz ] && {
+                       cp /tmp/sysupgrade.tgz /tmp/syscfg/sysupgrade.tgz
+               }
+               ;;
+       esac
 }
 
 }
 
-append sysupgrade_pre_upgrade linksys_preupgrade