[OpenWrt-Devel] [PATCH] ramips: Fix sysupgrade for Xiaomi mir3g

Mathias Kresin dev at kresin.me
Mon Jan 6 04:33:53 EST 2020


05/01/2020 15:17, Hauke Mehrtens:
> Without this change sysupgrade from 18.06 to 19.07 is only possible with
> the -F option.
> In OpenWrt 18.06 the nand_do_platform_check() function is called with
> the board name mir3g only, if the tar does not use mir3g it will fail.
> OpenWrt 19.07 and later support the metadata with the supported_devices
> attribute to allow renaming. Do the renaming of the target between 19.07
> and master like it is done for some other boards.
> 
> I tested the following sysupgrades successfully without -F
> 18.06 -> 19.07
> 19.07 -> master
> master -> 19.07
> 
> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> ---
>   target/linux/ramips/image/mt7621.mk | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
> index 7eb59188fb..39017a48e1 100644
> --- a/target/linux/ramips/image/mt7621.mk
> +++ b/target/linux/ramips/image/mt7621.mk
> @@ -269,7 +269,7 @@ define Device/xiaomi_mir3p
>   endef
>   TARGET_DEVICES += xiaomi_mir3p
>   
> -define Device/xiaomi_mir3g
> +define Device/mir3g
>     DTS := MIR3G
>     BLOCKSIZE := 128k
>     PAGESIZE := 2048
> @@ -282,12 +282,12 @@ define Device/xiaomi_mir3g
>     IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
>     DEVICE_TITLE := Xiaomi Mi Router 3G
>     SUPPORTED_DEVICES += R3G
> -  SUPPORTED_DEVICES += mir3g
> +  SUPPORTED_DEVICES += xiaomi,mir3g
>     DEVICE_PACKAGES := \
>   	kmod-mt7603 kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-basic \
>   	uboot-envtools
>   endef
> -TARGET_DEVICES += xiaomi_mir3g
> +TARGET_DEVICES += mir3g
>   
>   define Device/mt7621
>     DTS := MT7621
> 

Wouldn't it be the easiest to force the name used for the directory in 
the sysupgrade.tar to "sysupgrade-mir3g", to be compatible with 18.06 
and earlier?

It can be done by adding "BOARD_NAME := mir3g" to the device define in 
the 19.07 branch as well as master.

Beginning with 19.07, nand_do_platform_check() isn't used for ramips and 
nand_upgrade_tar() doesn't rely on the boardname either any longer. 
Instead, nand_upgrade_tar() will grab the kernel and rootfs from the 
first found directory matching the pattern "sysupgrade-.*". Means, we 
wouldn't introduce another compatibility issue.

Of course, a downgrade from master to 19.07 and earlier would still 
require the force argument due to the not matching name in the image 
metadata. Considering that we don't adjust the running config to be 
compatible with earlier releases during downgrade, I rather see this as 
a pro than as con.

Mathias

_______________________________________________
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