ath79: mikrotik: set compat version for NAND devices
authorRobert Marko <robimarko@gmail.com>
Wed, 19 Jun 2024 10:15:16 +0000 (12:15 +0200)
committerRobert Marko <robimarko@gmail.com>
Wed, 19 Jun 2024 10:26:19 +0000 (12:26 +0200)
Currently, trying to upgrade on a MikroTik NAND device will force you to
use sysupgrade -n due to:
upgrade: The device is supported, but the config is incompatible to the new image (1.0->1.1). Please upgrade without keeping config (sysupgrade -n).
upgrade: NAND images switched to yafut. If running older image, reinstall from initramfs.

So instead of having users manually set the new compat version lets do
what other targets do and set it for all NAND devices after good boot.

Link: https://github.com/openwrt/openwrt/pull/15754
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ath79/mikrotik/base-files/etc/board.d/05_compat-version [new file with mode: 0644]

diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/05_compat-version b/target/linux/ath79/mikrotik/base-files/etc/board.d/05_compat-version
new file mode 100644 (file)
index 0000000..2e079bf
--- /dev/null
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+. /lib/functions.sh
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+case "$(board_name)" in
+       mikrotik,routerboard-493g|\
+       mikrotik,routerboard-911g-5hpacd|\
+       mikrotik,routerboard-911g-xhpnd|\
+       mikrotik,routerboard-912uag-2hpnd|\
+       mikrotik,routerboard-921gs-5hpacd-15s|\
+       mikrotik,routerboard-922uags-5hpacd|\
+       mikrotik,routerboard-951g-2hnd|\
+       mikrotik,routerboard-951ui-2hnd|\
+       mikrotik,routerboard-sxt-5nd-r2)
+               ucidef_set_compat_version "1.1"
+               ;;
+esac
+
+board_config_flush
+
+exit 0