diff mbox series

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

Message ID 20181128190749.37069-1-jonathan@navigue.com
State Changes Requested
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,v3] octeon: Allow sysupgrade restore on ER | expand

Commit Message

Jonathan Thibault Nov. 28, 2018, 7:07 p.m. UTC
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(-)

Comments

John Crispin Dec. 3, 2018, 6:35 a.m. UTC | #1
On 28/11/2018 20:07, Jonathan Thibault wrote:
> 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.
Hi Jonathan,
ordering looks correct, however you are now mixing 2 things into 1 patch.
there is the part adding the er) blocks and a second change which fixes 
previously
broken ordering. these need to go into 2 separate patches.
     John


>
> ---
> 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`
diff mbox series

Patch

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`