mvebu: reformat the damaged syscfg partition on the mamba
authorImre Kaloz <kaloz@openwrt.org>
Sun, 12 Apr 2015 08:35:33 +0000 (08:35 +0000)
committerImre Kaloz <kaloz@openwrt.org>
Sun, 12 Apr 2015 08:35:33 +0000 (08:35 +0000)
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
SVN-Revision: 45386

target/linux/mvebu/base-files/lib/preinit/81_linksys_syscfg

index 54aff7dbcc8206a00151d031fcf38626ce8e3b5e..fdd0d1e6692d6e12197ae1e9575c33cb165631e7 100644 (file)
@@ -9,8 +9,17 @@ preinit_mount_syscfg() {
 
        case $(mvebu_board_name) in
        armada-xp-mamba)
 
        case $(mvebu_board_name) in
        armada-xp-mamba)
+               needs_recovery=0
+               ubiattach -m 8 || needs_recovery=1
+               if [ $needs_recovery -eq 1 ]
+               then
+                       echo "ubifs syscfg partition is damaged, reformatting"
+                       ubidetach -m 8
+                       ubiformat -y -O 2048 -q /dev/mtd8
+                       ubiattach -m 8
+                       ubimkvol /dev/ubi1 -n 0 -N syscfg -t dynamic --maxavsize
+               fi
                mkdir /tmp/syscfg
                mkdir /tmp/syscfg
-               ubiattach -p /dev/mtd8
                mount -t ubifs ubi1:syscfg /tmp/syscfg
                [ -f /tmp/syscfg/sysupgrade.tgz ] && {
                echo "- config restore -"
                mount -t ubifs ubi1:syscfg /tmp/syscfg
                [ -f /tmp/syscfg/sysupgrade.tgz ] && {
                echo "- config restore -"