aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/mt7621
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ramips/mt7621')
-rw-r--r--target/linux/ramips/mt7621/base-files/etc/board.d/02_network3
-rw-r--r--target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac5
-rwxr-xr-xtarget/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh4
-rw-r--r--target/linux/ramips/mt7621/base-files/lib/upgrade/zyxel.sh39
4 files changed, 50 insertions, 1 deletions
diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
index e357b47a4c..39c8080e83 100644
--- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
@@ -49,7 +49,8 @@ ramips_setup_interfaces()
xiaomi,mi-router-cr6606|\
xiaomi,mi-router-cr6608|\
xiaomi,mi-router-cr6609|\
- xiaomi,redmi-router-ac2100)
+ xiaomi,redmi-router-ac2100|\
+ zyxel,wsm20)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;
asiarf,ap7621-001|\
diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index b6337f397b..f042830e02 100644
--- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -181,4 +181,9 @@ case "$board" in
[ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
;;
+ zyxel,wsm20)
+ hw_mac_addr="$(mtd_get_mac_binary Factory 0x1fdfa)"
+ [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
+ ;;
esac
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
index bfdbd6a09d..ce5fdd61ed 100755
--- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
@@ -155,6 +155,10 @@ platform_do_upgrade() {
CI_KERNPART="Kernel"
nand_do_upgrade "$1"
;;
+ zyxel,wsm20)
+ zyxel_mstc_upgrade_prepare
+ nand_do_upgrade "$1"
+ ;;
*)
default_do_upgrade "$1"
;;
diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/zyxel.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/zyxel.sh
new file mode 100644
index 0000000000..59c8d237dd
--- /dev/null
+++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/zyxel.sh
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2023 OpenWrt.org
+#
+
+. /lib/functions.sh
+
+zyxel_mstc_prepare_fail() {
+ echo "failed to check and prepare the environment, rebooting..."
+ umount -a
+ reboot -f
+}
+
+zyxel_mstc_upgrade_prepare() {
+ local persist_mtd="$(find_mtd_part persist)"
+ local firmware_mtd="$(find_mtd_part firmware)"
+
+ if [ -z "$persist_mtd" ] || [ -z "$firmware_mtd" ]; then
+ echo 'cannot find mtd partition(s) "persist" or "firmware"'
+ zyxel_mstc_prepare_fail
+ fi
+
+ local bootnum=$(hexdump -s 4 -n 1 -e '"%x"' ${persist_mtd})
+
+ if [ "$bootnum" != "1" ] && [ "$bootnum" != "2" ]; then
+ echo "failed to get bootnum, please check the value at 0x4 in ${persist_mtd}"
+ zyxel_mstc_prepare_fail
+ fi
+ echo "current: bootnum => ${bootnum}"
+
+ [ "$(fw_printenv -n bootmenu_delay)" = "3" ] || fw_setenv bootmenu_delay 3
+
+ if [ "$bootnum" = "2" ]; then
+ if ! ( echo -ne "\x01" | dd of=${persist_mtd} count=1 bs=1 seek=4 conv=notrunc 2>/dev/null ); then
+ echo "failed to set new boot partition"
+ zyxel_mstc_prepare_fail
+ fi
+ echo "### switch to 1st os-image on next boot ###"
+ fi
+}