[OpenWrt-Devel] [PATCH v3] octeon: Allow sysupgrade restore on ER

Jonathan Thibault jonathan at navigue.com
Wed Nov 28 14:07:49 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.

---
v2: checks board name in alphabetical order
v3: used git send-email to avoid patch mangling
---
 target/linux/octeon/base-files/lib/preinit/79_move_config |  5 +++++
 target/linux/octeon/base-files/lib/upgrade/platform.sh    | 15 ++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

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`
-- 
2.12.2


_______________________________________________
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