diff options
author | Tomasz Maciej Nowak <tmn505@gmail.com> | 2022-06-07 15:58:27 +0200 |
---|---|---|
committer | Christian Lamparter <chunkeey@gmail.com> | 2022-06-24 17:09:54 +0200 |
commit | 5c142aad7bc018fe000789740a486c49973035b8 (patch) | |
tree | 0506a6f394f4fd5024a1182d17c008ed54291c35 /target/linux/ath79/generic | |
parent | 4cca0947fff08716eb2190795d94072e3126f86b (diff) | |
download | upstream-5c142aad7bc018fe000789740a486c49973035b8.tar.gz upstream-5c142aad7bc018fe000789740a486c49973035b8.tar.bz2 upstream-5c142aad7bc018fe000789740a486c49973035b8.zip |
ath79: switch some RedBoot based devices to OKLI loader
After the kernel has switched version to 5.10, JA76PF2 and
RouterStations lost the capability to sysupgrade the OpenWrt version.
The cause is the lack of porting the patches responsible for partial
flash erase block writing and these boards FIS directory and RedBoot
config partitions share the same erase block. Because of that the FIS
directory can't be updated to accommodate kernel/rootfs partition size
changes. This could be remedied by bootloader update, but it is very
intrusive and could potentially lead to non-trivial recovery procedure,
if something went wrong. The less difficult option is to use OpenWrt
kernel loader, which will let us use static partition sizes and employ
mtd splitter to dynamically adjust kernel and rootfs partition sizes.
On sysupgrade from ath79 19.07 or 21.02 image, which still let to modify
FIS directory, the loader will be written to kernel partition, while the
kernel+rootfs to rootfs partition.
The caveats are:
* image format changes, no possible upgrade from ar71xx target images
* downgrade to any older OpenWrt version will require TFTP recovery or
usage of bootloader command line interface
To downgrade to 19.07 or 21.02, or to upgrade if one is already on
OpenWrt with kernel 5.10, for RouterStations use TFTP recovery
procedure. For JA76PF2 use instructions from this commit message:
commit 0cc87b3bacee ("ath79: image: disable sysupgrade images for routerstations and ja76pf2"),
replacing kernel image with loader (loader.bin suffix) and rootfs
image with firmware (firmware.bin suffix).
Fixes: b10d6044599d ("kernel: add linux 5.10 support")
Fixes: 15aa53d7ee65 ("ath79: switch to Kernel 5.10")
Signed-off-by: Tomasz Maciej Nowak <tmn505@gmail.com>
(mkubntimage was moved to generic-ubnt.mk)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/ath79/generic')
-rw-r--r-- | target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version | 5 | ||||
-rw-r--r-- | target/linux/ath79/generic/base-files/lib/upgrade/platform.sh | 20 |
2 files changed, 14 insertions, 11 deletions
diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version index a6b7fa3162..6646b7e5e7 100644 --- a/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version +++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/05_fix-compat-version @@ -1,8 +1,11 @@ . /lib/functions.sh case "$(board_name)" in + jjplus,ja76pf2|\ meraki,mr12|\ - meraki,mr16) + meraki,mr16|\ + ubnt,routerstation|\ + ubnt,routerstation-pro) uci set system.@system[0].compat_version="2.0" uci commit system ;; diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index 953d6a96d3..642a9891ff 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -14,21 +14,21 @@ redboot_fis_do_upgrade() { local kern_part="$2" local magic=$(get_magic_word "$sysup_file") - if [ "$magic" = "4349" ]; then - local kern_length=0x$(dd if="$sysup_file" bs=2 skip=1 count=4 2>/dev/null) + if [ "$magic" = "7379" ]; then + local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" - dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \ - mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs - elif [ "$magic" = "7379" ]; then - local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') - local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + if grep -q "mtd1.*loader" /proc/mtd; then + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append write - loader:firmware - [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" - tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ - mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + else + local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs + fi else echo "Unknown image, aborting!" return 1 |