[OpenWrt-Devel] [PATCH v2] octeon: Allow sysupgrade restore on ER
    Jonathan Thibault 
    jonathan at navigue.com
       
    Tue Nov 13 09:48:47 EST 2018
    
    
  
This is a very simple patch that completes sysupgrade functionality on 
UBNT ER8.
Default layout leaves about 128MB free on the kernel partition so there 
is plenty of space for temporary config backups.
This version checks board names in alphabetical order.
diff --git a/target/linux/octeon/base-files/lib/preinit/79_move_config 
b/target/linux/octeon/base-files/lib/preinit/79_move_config
index ec63d9f5ff..470cbfe005 100644
--- a/target/linux/octeon/base-files/lib/preinit/79_move_config
+++ b/target/linux/octeon/base-files/lib/preinit/79_move_config
@@ -5,6 +5,11 @@ move_config() {
         . /lib/functions.sh
         case "$(board_name)" in
+               er)
+                       mount -t vfat /dev/mmcblk0p1 /mnt
+                       [ -f /mnt/sysupgrade.tgz ] && mv -f 
/mnt/sysupgrade.tgz /
+                       umount /mnt
+                       ;;
                 erlite)
                         mount -t vfat /dev/sda1 /mnt
                         [ -f /mnt/sysupgrade.tgz ] && mv -f 
/mnt/sysupgrade.tgz /
diff --git a/target/linux/octeon/base-files/lib/upgrade/platform.sh 
b/target/linux/octeon/base-files/lib/upgrade/platform.sh
index cd49c0da36..009eae7a2c 100755
--- a/target/linux/octeon/base-files/lib/upgrade/platform.sh
+++ b/target/linux/octeon/base-files/lib/upgrade/platform.sh
@@ -23,6 +23,11 @@ platform_get_rootfs() {
  platform_copy_config() {
         case "$(board_name)" in
+       er)
+               mount -t vfat /dev/mmcblk0p1 /mnt
+               cp -af "$CONF_TAR" /mnt/
+               umount /mnt
+               ;;
         erlite)
                 mount -t vfat /dev/sda1 /mnt
                 cp -af "$CONF_TAR" /mnt/
@@ -62,12 +67,12 @@ platform_do_upgrade() {
         [ -b "${rootfs}" ] || return 1
         case "$board" in
-       erlite)
-               kernel=sda1
-               ;;
         er)
                 kernel=mmcblk0p1
                 ;;
+       erlite)
+               kernel=sda1
+               ;;
         *)
                 return 1
         esac
@@ -82,8 +87,8 @@ platform_check_image() {
         local board=$(board_name)
         case "$board" in
-       erlite | \
-       er)
+       er | \
+       erlite)
                 local tar_file="$1"
                 local kernel_length=`(tar xf $tar_file 
sysupgrade-$board/kernel -O | wc -c) 2> /dev/null`
                 local rootfs_length=`(tar xf $tar_file 
sysupgrade-$board/root -O | wc -c) 2> /dev/null`
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
    
    
More information about the openwrt-devel
mailing list