summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ar71xx/base-files')
-rw-r--r--target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network8
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh81
-rw-r--r--target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom52
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/00_inittab-console-fixup (renamed from target/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup)0
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/01_leds (renamed from target/linux/ar71xx/base-files/etc/uci-defaults/leds)62
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/02_network (renamed from target/linux/ar71xx/base-files/etc/uci-defaults/network)130
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration106
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/03_network-vlan-migration (renamed from target/linux/ar71xx/base-files/etc/uci-defaults/vlan-migration)0
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/09_wrt160nl (renamed from target/linux/ar71xx/base-files/etc/uci-defaults/wrt160nl)0
-rw-r--r--target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration66
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh108
-rw-r--r--target/linux/ar71xx/base-files/lib/upgrade/dir825.sh177
-rw-r--r--target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh (renamed from target/linux/ar71xx/base-files/lib/upgrade/om2p.sh)56
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh77
-rwxr-xr-xtarget/linux/ar71xx/base-files/sbin/wget2nand4
15 files changed, 751 insertions, 176 deletions
diff --git a/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network b/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network
index 69d7dc712..ad05525d2 100644
--- a/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network
+++ b/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network
@@ -10,11 +10,19 @@ config interface lan
option proto static
option ipaddr 192.168.1.1
option netmask 255.255.255.0
+ option ip6assign 60
config interface wan
option ifname eth1
option proto dhcp
+config interface wan6
+ option ifname @wan
+ option proto dhcpv6
+
+config globals globals
+ option ula_prefix auto
+
config switch
option name rtl8366s
option reset 1
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 570bdcb84..ed269b275 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -1,33 +1,9 @@
#!/bin/sh
-#
-# Copyright (C) 2009 OpenWrt.org
-#
-#
+# Copyright (C) 2009-2013 OpenWrt.org
+. /lib/functions/leds.sh
. /lib/ar71xx.sh
-status_led=""
-
-led_set_attr() {
- [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
-}
-
-status_led_set_timer() {
- led_set_attr $status_led "trigger" "timer"
- led_set_attr $status_led "delay_on" "$1"
- led_set_attr $status_led "delay_off" "$2"
-}
-
-status_led_on() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 255
-}
-
-status_led_off() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 0
-}
-
get_status_led() {
case $(ar71xx_board_name) in
alfa-nx)
@@ -36,9 +12,16 @@ get_status_led() {
all0305)
status_led="eap7660d:green:ds4"
;;
- ap136)
+ ap132)
+ status_led="ap132:green:status"
+ ;;
+ ap136-010|\
+ ap136-020)
status_led="ap136:green:status"
;;
+ ap135-020)
+ status_led="ap135:green:status"
+ ;;
ap81)
status_led="ap81:green:status"
;;
@@ -54,6 +37,9 @@ get_status_led() {
bullet-m | rocket-m | nano-m | nanostation-m)
status_led="ubnt:green:link4"
;;
+ cap4200ag)
+ status_led="senao:green:pwr"
+ ;;
db120)
status_led="db120:green:status"
;;
@@ -65,8 +51,10 @@ get_status_led() {
status_led="d-link:green:status"
;;
dir-825-b1 |\
- dir-825-b1-openwrt |\
- dir-825-b1-stock)
+ dir-835-a1)
+ status_led="d-link:orange:power"
+ ;;
+ dir-825-c1)
status_led="d-link:orange:power"
;;
eap7660d)
@@ -82,6 +70,12 @@ get_status_led() {
ls-sr71)
status_led="ubnt:green:d22"
;;
+ mr600)
+ status_led="mr600:orange:power"
+ ;;
+ mr600v2)
+ status_led="mr600:blue:power"
+ ;;
mzk-w04nu | \
mzk-w300nh)
status_led="planex:green:status"
@@ -90,6 +84,7 @@ get_status_led() {
status_led="nbg460n:green:power"
;;
om2p | \
+ om2p-hs | \
om2p-lc)
status_led="om2p:blue:power"
;;
@@ -121,20 +116,25 @@ get_status_led() {
status_led="tp-link:green:wps"
;;
tl-mr3220 | \
+ tl-mr3220-v2 | \
tl-mr3420 | \
+ tl-mr3420-v2 | \
tl-wa901nd | \
tl-wa901nd-v2 | \
+ tl-wdr3500 | \
tl-wr1041n-v2 | \
tl-wr1043nd | \
tl-wr741nd | \
tl-wr741nd-v4 | \
tl-wr841n-v1 | \
tl-wr841n-v7 | \
+ tl-wr841n-v8 | \
tl-wr941nd)
status_led="tp-link:green:system"
;;
tl-wdr4300 | \
- tl-wr703n)
+ tl-wr703n | \
+ tl-wr720n-v3)
status_led="tp-link:blue:system"
;;
tl-wr2543n)
@@ -143,6 +143,9 @@ get_status_led() {
unifi)
status_led="ubnt:green:dome"
;;
+ uap-pro)
+ status_led="ubnt:white:dome"
+ ;;
whr-g301n | \
whr-hp-g300n | \
whr-hp-gn | \
@@ -156,9 +159,15 @@ get_status_led() {
wzr-hp-g300nh2)
status_led="buffalo:red:diag"
;;
+ wndap360)
+ status_led="wndap360:green:power"
+ ;;
wndr3700)
status_led="wndr3700:green:power"
;;
+ wndr4300)
+ status_led="netgear:green:power"
+ ;;
wnr2000)
status_led="wnr2000:green:power"
;;
@@ -174,7 +183,7 @@ get_status_led() {
zcn-1523h-2 | zcn-1523h-5)
status_led="zcn-1523h:amber:init"
;;
- esac;
+ esac
}
set_state() {
@@ -182,13 +191,13 @@ set_state() {
case "$1" in
preinit)
- insmod leds-gpio
- insmod ledtrig-default-on
- insmod ledtrig-timer
- status_led_set_timer 200 200
+ insmod leds-gpio 2> /dev/null
+ insmod ledtrig-default-on 2> /dev/null
+ insmod ledtrig-timer 2> /dev/null
+ status_led_blink_preinit
;;
failsafe)
- status_led_set_timer 50 50
+ status_led_blink_failsafe
;;
done)
status_led_on
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
new file mode 100644
index 000000000..0fd681383
--- /dev/null
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+ath9k_eeprom_die() {
+ echo "ath9k eeprom: " "$*"
+ exit 1
+}
+
+ath9k_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+
+ . /lib/functions.sh
+
+ mtd=$(find_mtd_chardev $part)
+ [ -n "$mtd" ] || \
+ ath9k_eeprom_die "no mtd device found for partition $part"
+
+ dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
+ ath9k_eeprom_die "failed to extract from $mtd"
+}
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/ar71xx.sh
+
+board=$(ar71xx_board_name)
+
+case "$FIRMWARE" in
+"soc_wmac.eeprom")
+ case $board in
+ wndr4300)
+ ath9k_eeprom_extract "caldata" 4096 2048
+ ;;
+ *)
+ ath9k_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+
+"pci_wmac0.eeprom")
+ case $board in
+ wndr4300)
+ ath9k_eeprom_extract "caldata" 20480 2048
+ ;;
+ *)
+ ath9k_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup b/target/linux/ar71xx/base-files/etc/uci-defaults/00_inittab-console-fixup
index 4098b37a7..4098b37a7 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/inittab-console-fixup
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/00_inittab-console-fixup
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index 5e2e9acfb..6e3e37092 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -32,11 +32,17 @@ ap113)
ucidef_set_led_usbdev "usb" "USB" "ap113:green:usb" "1-1"
;;
+cap4200ag)
+ ucidef_set_led_default "lan_green" "LAN_GREEN" "senao:green:lan" "1"
+ ucidef_set_led_wlan "wlan_amber" "WLAN_AMBER" "senao:amber:wlan" "phy0tpt"
+ ucidef_set_led_wlan "wlan_green" "WLAN_GREEN" "senao:green:wlan" "phy1tpt"
+ ;;
+
db120)
ucidef_set_led_usbdev "usb" "USB" "db120:green:usb" "1-1"
;;
-rb750)
+rb-750)
ucidef_set_led_default "act" "act" "rb750:green:act" "1"
ucidef_set_led_netdev "port1" "port1" "rb750:green:port1" "eth1"
ucidef_set_led_switch "port2" "port2" "rb750:green:port2" "switch0" "0x10"
@@ -54,7 +60,8 @@ dir-615-e4)
ucidef_set_led_switch "lan4" "LAN4" "d-link:green:lan4" "switch0" "0x10"
;;
-dir-825-b1)
+dir-825-b1 | \
+dir-825-c1)
ucidef_set_led_usbdev "usb" "USB" "d-link:blue:usb" "1-1"
;;
@@ -65,6 +72,10 @@ hornet-ub)
ucidef_set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1"
;;
+mr600)
+ ucidef_set_led_wlan "wlan58" "WLAN58" "mr600:green:wlan58" "phy0tpt"
+ ;;
+
mzk-w04u)
ucidef_set_led_usbdev "usb" "USB" "planex:green:usb" "1-1"
;;
@@ -78,6 +89,7 @@ nbg460n_550n_550nh)
;;
om2p | \
+om2p-hs | \
om2p-lc)
ucidef_set_led_netdev "port1" "port1" "om2p:blue:wan" "eth0"
ucidef_set_led_netdev "port2" "port2" "om2p:blue:lan" "eth1"
@@ -93,7 +105,8 @@ tew-712br)
;;
tl-mr11u | \
-tl-mr3020)
+tl-mr3020 | \
+tl-mr3040)
ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
@@ -104,6 +117,26 @@ tl-mr3420 )
ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
;;
+tl-mr3220-v2)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+ ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
+ ;;
+
+tl-mr3420-v2)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+ ucidef_set_led_usbdev "usb" "USB" "tp-link:green:3g" "1-1"
+ ;;
+
tl-wa901nd)
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
;;
@@ -112,6 +145,11 @@ tl-wa901nd-v2)
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
;;
+tl-wdr3500)
+ ucidef_set_led_usbdev "usb" "USB" "tp-link:green:usb" "1-1"
+ ucidef_set_led_wlan "wlan2g" "WLAN2G" "tp-link:green:wlan2g" "phy0tpt"
+ ;;
+
tl-wdr4300)
ucidef_set_led_usbdev "usb1" "USB1" "tp-link:green:usb1" "1-1.1"
ucidef_set_led_usbdev "usb2" "USB2" "tp-link:green:usb2" "1-1.2"
@@ -135,6 +173,15 @@ tl-wr741nd-v4)
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
;;
+tl-wr841n-v8)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+ ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+ ;;
+
tl-wr941nd | \
tl-wr1041n-v2)
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
@@ -153,11 +200,20 @@ wrt160nl)
ucidef_set_led_wlan "wlan" "WLAN" "wrt160nl:blue:wlan" "phy0tpt"
;;
+wndap360)
+ ucidef_set_led_power "power" "POWER GREEN" "wndap360:green:power" "1"
+ ;;
+
wndr3700)
ucidef_set_led_default "wan" "WAN LED (green)" "wndr3700:green:wan" "0"
ucidef_set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1"
;;
+wndr4300)
+ ucidef_set_led_netdev "wan" "WAN (green)" "netgear:green:wan" "eth0.2"
+ ucidef_set_led_usbdev "usb" "USB" "netgear:green:usb" "1-1"
+ ;;
+
whr-g301n |\
whr-hp-g300n |\
whr-hp-gn)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index f749cc668..a9a3ff2e9 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -17,34 +17,55 @@ board=$(ar71xx_board_name)
case "$board" in
all0315n |\
all0258n |\
-ja76pf2)
+ja76pf2|\
+ubnt-unifi-outdoor)
ucidef_set_interface_lan "eth0 eth1"
;;
+ap132)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
+ ucidef_add_switch_vlan "switch0" "2" "0t 1"
+ ;;
+
+ap136-010)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ ucidef_add_switch_vlan "switch0" "2" "5 6"
+ ;;
+
+ap136-020 |\
+ap135-020)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ ucidef_add_switch_vlan "switch0" "2" "5 6"
+ ;;
+
db120 |\
rb-2011l | \
rb-2011uas-2hnd)
ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
- ucidef_add_switch_vlan "eth0" "2" "0t 1"
- ucidef_add_switch "eth1" "1" "1"
- ucidef_add_switch_vlan "eth1" "1" "0 1 2 3 4 5"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
+ ucidef_add_switch_vlan "switch0" "2" "0t 1"
+ ucidef_add_switch "switch1" "1" "1"
+ ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 4 5"
;;
dir-825-b1|\
-dir-825-b1-openwrt|\
-dir-825-b1-tostock|\
tew-673gru)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
- ucidef_add_switch "rtl8366s" "1" "1"
- ucidef_add_switch_vlan "rtl8366s" "1" "0 1 2 3 5t"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
;;
nbg460n_550n_550nh)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "rtl8366s" "1" "1"
- ucidef_add_switch_vlan "rtl8366s" "0" "0 1 2 3 5"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "0" "0 1 2 3 5"
;;
rb-433 |\
@@ -54,10 +75,16 @@ rb-433u)
ucidef_add_switch_vlan "switch0" "1" "1 2 5"
;;
+rb-435g)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2"
+ ;;
+
rb-450)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
- ucidef_add_switch "eth1" "1" "1"
- ucidef_add_switch_vlan "eth1" "1" "0 1 2 3 5"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5"
;;
rb-450g |\
@@ -70,6 +97,7 @@ routerstation-pro)
ap136 |\
rb-750gl |\
rb-751g |\
+rb-951g-2hnd |\
wzr-hp-g450h)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
@@ -90,24 +118,24 @@ wzr-hp-g300nh2 |\
pb92 |\
ap113)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0t 1 3 4 5"
- ucidef_add_switch_vlan "eth0" "2" "0t 2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 1 3 4 5"
+ ucidef_add_switch_vlan "switch0" "2" "0t 2"
;;
tl-wdr4300|\
tl-wr1041n-v2)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
- ucidef_add_switch_vlan "eth0" "2" "0t 1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
+ ucidef_add_switch_vlan "switch0" "2" "0t 1"
;;
tl-wr1043nd)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
- ucidef_add_switch "rtl8366rb" "1" "1"
- ucidef_add_switch_vlan "rtl8366rb" "1" "1 2 3 4 5t"
- ucidef_add_switch_vlan "rtl8366rb" "2" "0 5t"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
+ ucidef_add_switch_vlan "switch0" "2" "0 5t"
;;
tl-wr2543n)
@@ -123,10 +151,24 @@ tl-wr941nd)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
+tl-mr3420-v2 |\
+tl-wr841n-v8 |\
+wnr2000-v3)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ ;;
+
+uap-pro)
+ ucidef_set_interface_lan "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2"
+ ;;
+
wrt160nl)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 4 5"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5"
;;
wzr-hp-g300nh)
@@ -135,17 +177,30 @@ wzr-hp-g300nh)
ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
;;
+dir-825-c1 |\
+dir-835-a1 |\
+wndr4300)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 1 2 3 4"
+ ucidef_add_switch_vlan "switch0" "2" "0t 5"
+ ;;
+
all0305 |\
aw-nr580 |\
bullet-m |\
+cap4200ag |\
eap7660d |\
-ew-dorin |\
+mr600 |\
+mr600v2 |\
rb-411 |\
tl-mr11u |\
tl-mr3020 |\
+tl-mr3040 |\
tl-wa901nd |\
tl-wa901nd-v2 |\
tl-wr703n |\
+wndap360 |\
wp543)
ucidef_set_interface_lan "eth0"
;;
@@ -157,6 +212,7 @@ jwap003 |\
pb42 |\
pb44 |\
routerstation|\
+tl-wr720n-v3|\
wpe72)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
;;
@@ -174,7 +230,9 @@ rb-751 |\
tew-632brp |\
tew-712br |\
tl-mr3220 |\
+tl-mr3220-v2 |\
tl-mr3420 |\
+tl-wdr3500 |\
tl-wr741nd |\
tl-wr741nd-v4 |\
tl-wr841n-v7 |\
@@ -183,21 +241,27 @@ whr-hp-g300n |\
whr-hp-gn |\
wzr-hp-ag300h)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 4"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
;;
wzr-hp-g450h)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
- ucidef_add_switch_vlan "eth0" "2" "0t 1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
+ ucidef_add_switch_vlan "switch0" "2" "0t 1"
+ ;;
+
+ew-dorin)
+ ucidef_set_interface_lan "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3"
;;
ew-dorin-router)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0 2 3"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 2 3"
;;
*)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
new file mode 100755
index 000000000..718a924f1
--- /dev/null
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration
@@ -0,0 +1,106 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+SWITCH_NAME_CHANGED=
+
+do_change_switch_name() {
+ local config="$1"
+ local option=$2
+ local oldname=$3
+ local newname=$4
+ local val
+
+ config_get val "$config" $option
+ [ "$val" != "$oldname" ] && return 0
+
+ uci_set network "$config" $option $newname
+ SWITCH_NAME_CHANGED=1
+
+ return 0
+}
+
+migrate_switch_name() {
+ local oldname=$1
+ local newname=$2
+
+ . /lib/functions.sh
+
+ config_load network
+
+ logger -t migrate-switchX "Updating switch names in network configuration"
+
+ config_foreach do_change_switch_name switch name $oldname $newname
+ config_foreach do_change_switch_name switch_vlan device $oldname $newname
+
+ [ "$SWITCH_NAME_CHANGED" == "1" ] && {
+ logger -t migrate-switchX "Switch names updated, saving network configuration"
+ uci commit network
+ }
+}
+
+. /lib/ar71xx.sh
+
+board=$(ar71xx_board_name)
+
+case "$board" in
+dir-825-c1|\
+wzr-hp-g300nh2|\
+pb92|\
+ap113|\
+tl-wdr4300|\
+tl-wr1041n-v2|\
+wrt160nl|\
+ap121|\
+ap121-mini|\
+ap96|\
+airrouter|\
+dir-600-a1|\
+dir-615-c1|\
+dir-615-e4|\
+ja76pf|\
+rb-750|\
+rb-751|\
+tew-632brp|\
+tew-712br|\
+tl-mr3220|\
+tl-mr3220-v2 |\
+tl-mr3420|\
+tl-wr741nd|\
+tl-wr741nd-v4|\
+tl-wr841n-v7|\
+whr-g301n|\
+whr-hp-g300n|\
+whr-hp-gn|\
+wzr-hp-ag300h|\
+wzr-hp-g450h|\
+ew-dorin|\
+ew-dorin-router)
+ migrate_switch_name "eth0" "switch0"
+ ;;
+
+rb-450)
+ migrate_switch_name "eth1" "switch0"
+ ;;
+
+db120 |\
+rb-2011l | \
+rb-2011uas-2hnd)
+ migrate_switch_name "eth0" "switch0"
+ migrate_switch_name "eth1" "switch1"
+ ;;
+
+dir-825-b1|\
+tew-673gru|\
+nbg460n_550n_550nh)
+ migrate_switch_name "rtl8366s" "switch0"
+ ;;
+
+tl-wr1043nd)
+ migrate_switch_name "rtl8366rb" "switch0"
+ ;;
+
+esac
+
+exit 0
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/vlan-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-vlan-migration
index bea9493c8..bea9493c8 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/vlan-migration
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-vlan-migration
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/wrt160nl b/target/linux/ar71xx/base-files/etc/uci-defaults/09_wrt160nl
index dce28dde9..dce28dde9 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/wrt160nl
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/09_wrt160nl
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration
deleted file mode 100644
index 750ff405d..000000000
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/caldata-migration
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2011 OpenWrt.org
-#
-
-. /lib/functions/uci-defaults.sh
-. /lib/ar71xx.sh
-
-board=$(ar71xx_board_name)
-
-findmtd() {
- local partname="$1"
- grep "\"$partname\"" /proc/mtd | awk -F: '{ print $1 }'
-}
-
-getcalmac() {
- local partname="$1"
- local offset="$2"
-
- hexdump -e '17/1 "%c"' -s $offset -n 17 /dev/$(findmtd $partname) | tr -d : | tr 'A-Z' 'a-z'
-}
-
-calcmacX() {
- local mac="$1"
- local X="$2"
-
- local oui="$(expr substr "$mac" 1 6)"
- local end="$(expr substr "$mac" 7 12)"
-
- echo -n $oui
- expr substr "$(printf "%6lx" "$(($(printf "%lu" 0x${end}) + $X))")" 1 6
-}
-
-getifmac() {
- local ifname="$1"
-
- local ifmac
-
- ifmac="$(ifconfig "$ifname" | grep HWaddr)"
- ifmac="${ifmac#*HWaddr }"
- ifmac="${ifmac%% *}"
-
- echo "$ifmac" | tr -d : | tr 'A-Z' 'a-z'
-}
-
-case "$board" in
-dir-825-b1)
- mac1="$(getcalmac caldata 65440)"
- mac1="$(calcmacX "$mac1" 2)"
- mac2="$(calcmacX "$mac1" 1)"
-
- if grep -q '"owrt_caldata"' /proc/mtd && [ "$mac1" = "$(getifmac eth0)" ] && [ "$mac2" = "$(getifmac eth1)" ]; then
- dd if=/dev/$(findmtd caldata) of=/dev/$(findmtd owrt_caldata) bs=65536 count=1
- fi
- ;;
-dir-825-b1-tostock)
- mac1="$(getcalmac owrt_caldata 65440)"
- mac1="$(calcmacX "$mac1" 2)"
- mac2="$(calcmacX "$mac1" 1)"
- if grep -q '"owrt_caldata"' /proc/mtd && [ "$mac1" = "$(getifmac eth0)" ] && [ "$mac2" = "$(getifmac eth1)" ]; then
- dd if=/dev/$(findmtd owrt_caldata) of=/dev/$(findmtd caldata) bs=65536 count=1
- fi
- ;;
-esac
-
-return 0
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 8db983039..194a40b5c 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -62,12 +62,22 @@ tplink_get_hwid() {
dd if=$part bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
+tplink_get_mid() {
+ local part
+
+ part=$(find_mtd_part firmware)
+ [ -z "$part" ] && return 1
+
+ dd if=$part bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
tplink_board_detect() {
local model="$1"
local hwid
local hwver
hwid=$(tplink_get_hwid)
+ mid=$(tplink_get_mid)
hwver=${hwid:6:2}
hwver="v${hwver#0}"
@@ -75,6 +85,9 @@ tplink_board_detect() {
"070300"*)
model="TP-Link TL-WR703N"
;;
+ "072001"*)
+ model="TP-Link TL-WR720N"
+ ;;
"070100"*)
model="TP-Link TL-WA701N/ND"
;;
@@ -87,6 +100,12 @@ tplink_board_detect() {
"074300"*)
model="TP-Link TL-WR743N/ND"
;;
+ "080100"*)
+ model="TP-Link TL-WA801N/ND"
+ ;;
+ "083000"*)
+ model="TP-Link TL-WA830RE"
+ ;;
"084100"*)
model="TP-Link TL-WR841N/ND"
;;
@@ -97,7 +116,12 @@ tplink_board_detect() {
model="TP-Link TL-WA901N/ND"
;;
"094100"*)
- model="TP-Link TL-WR941N/ND"
+ if [ "$hwid" == "09410002" -a "$mid" == "00420001" ]; then
+ model="Rosewill RNX-N360RT"
+ hwver=""
+ else
+ model="TP-Link TL-WR941N/ND"
+ fi
;;
"104100"*)
model="TP-Link TL-WR1041N/ND"
@@ -123,6 +147,9 @@ tplink_board_detect() {
"342000"*)
model="TP-Link TL-MR3420"
;;
+ "350000"*)
+ model="TP-Link TL-WDR3500"
+ ;;
"360000"*)
model="TP-Link TL-WDR3600"
;;
@@ -174,8 +201,17 @@ ar71xx_board_detect() {
*AP121-MINI)
name="ap121-mini"
;;
- *"AP136 reference board")
- name="ap136"
+ *"AP132 reference board")
+ name="ap132"
+ ;;
+ *"AP136-010 reference board")
+ name="ap136-010"
+ ;;
+ *"AP136-020 reference board")
+ name="ap136-020"
+ ;;
+ *"AP135-020 reference board")
+ name="ap135-020"
;;
*AP81)
name="ap81"
@@ -189,6 +225,9 @@ ar71xx_board_detect() {
*AW-NR580)
name="aw-nr580"
;;
+ *CAP4200AG)
+ name="cap4200ag"
+ ;;
*"DB120 reference board")
name="db120"
;;
@@ -201,11 +240,11 @@ ar71xx_board_detect() {
*"DIR-825 rev. B1")
name="dir-825-b1"
;;
- *"DIR-825 rev. B1 OpenWrt")
- name="dir-825-b1-openwrt"
+ *"DIR-825 rev. C1")
+ name="dir-825-c1"
;;
- *"DIR-825 rev. B1 TOSTOCK")
- name="dir-825-b1-tostock"
+ *"DIR-835 rev. A1")
+ name="dir-835-a1"
;;
*EAP7660D)
name="eap7660d"
@@ -231,6 +270,12 @@ ar71xx_board_detect() {
*LS-SR71)
name="ls-sr71"
;;
+ *MR600v2)
+ name="mr600v2"
+ ;;
+ *MR600)
+ name="mr600"
+ ;;
*MZK-W04NU)
name="mzk-w04nu"
;;
@@ -243,6 +288,9 @@ ar71xx_board_detect() {
*OM2P)
name="om2p"
;;
+ *"OM2P HS")
+ name="om2p-hs"
+ ;;
*"OM2P LC")
name="om2p-lc"
;;
@@ -267,6 +315,9 @@ ar71xx_board_detect() {
*"RouterBOARD 433UAH")
name="rb-433u"
;;
+ *"RouterBOARD 435G")
+ name="rb-435g"
+ ;;
*"RouterBOARD 450")
name="rb-450"
;;
@@ -291,6 +342,9 @@ ar71xx_board_detect() {
*"RouterBOARD 751G")
name="rb-751g"
;;
+ *"RouterBOARD 951G-2HnD")
+ name="rb-951g-2hnd"
+ ;;
*"RouterBOARD 2011L")
name="rb-2011l"
;;
@@ -333,18 +387,33 @@ ar71xx_board_detect() {
*TL-MR3020)
name="tl-mr3020"
;;
+ *TL-MR3040)
+ name="tl-mr3040"
+ ;;
*TL-MR3220)
name="tl-mr3220"
;;
+ *"TL-MR3220 v2")
+ name="tl-mr3220-v2"
+ ;;
*TL-MR3420)
name="tl-mr3420"
;;
+ *"TL-MR3420 v2")
+ name="tl-mr3420-v2"
+ ;;
+ *TL-WA7510N)
+ name="tl-wa7510n"
+ ;;
*TL-WA901ND)
name="tl-wa901nd"
;;
*"TL-WA901ND v2")
name="tl-wa901nd-v2"
;;
+ *"TL-WDR3500")
+ name="tl-wdr3500"
+ ;;
*"TL-WDR3600/4300/4310")
name="tl-wdr4300"
;;
@@ -360,18 +429,27 @@ ar71xx_board_detect() {
*"TL-WR841N/ND v7")
name="tl-wr841n-v7"
;;
+ *"TL-WR841N/ND v8")
+ name="tl-wr841n-v8"
+ ;;
*TL-WR941ND)
name="tl-wr941nd"
;;
*"TL-WR703N v1")
name="tl-wr703n"
;;
+ *"TL-WR720N v3")
+ name="tl-wr720n-v3"
+ ;;
*"TL-MR11U")
name="tl-mr11u"
;;
*UniFi)
name="unifi"
;;
+ *"UniFi AP Pro")
+ name="uap-pro"
+ ;;
*WHR-G301N)
name="whr-g301n"
;;
@@ -381,15 +459,27 @@ ar71xx_board_detect() {
*WLAE-AG300N)
name="wlae-ag300n"
;;
+ *"UniFiAP Outdoor")
+ name="unifi-outdoor"
+ ;;
*WP543)
name="wp543"
;;
*WPE72)
name="wpe72"
;;
+ *WNDAP360)
+ name="wndap360"
+ ;;
*"WNDR3700/WNDR3800/WNDRMAC")
wndr3700_board_detect "$machine"
;;
+ *"WNDR4300")
+ name="wndr4300"
+ ;;
+ *"WNR2000 V3")
+ name="wnr2000-v3"
+ ;;
*WNR2000)
name="wnr2000"
;;
@@ -399,7 +489,7 @@ ar71xx_board_detect() {
*WRT400N)
name="wrt400n"
;;
- *WZR-HP-AG300H)
+ *"WZR-HP-AG300H/WZR-600DHP")
name="wzr-hp-ag300h"
;;
*WZR-HP-G300NH)
@@ -429,7 +519,7 @@ ar71xx_board_detect() {
esac
case "$machine" in
- *TL-WR* | *TL-WA* | *TL-MR*)
+ *TL-WR* | *TL-WA* | *TL-MR* | *TL-WD*)
tplink_board_detect "$machine"
;;
esac
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh b/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh
new file mode 100644
index 000000000..e16128a9c
--- /dev/null
+++ b/target/linux/ar71xx/base-files/lib/upgrade/dir825.sh
@@ -0,0 +1,177 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+. /lib/functions.sh
+. /lib/ar71xx.sh
+
+get_mtd_part_size() {
+ local part_name=$1
+ local first dev size erasesize name
+ while read dev size erasesize name; do
+ name=${name#'"'}; name=${name%'"'}
+ if [ "$name" = "$part_name" ]; then
+ echo $((0x$size))
+ break
+ fi
+ done < /proc/mtd
+}
+
+get_magic_at() {
+ local mtddev=$1
+ local pos=$2
+ dd bs=1 count=2 skip=$pos if=$mtddev 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
+dir825b_is_caldata_valid() {
+ local mtddev=$1
+ local magic
+
+ magic=$(get_magic_at $mtddev 4096)
+ [ "$magic" != "a55a" ] && return 0
+
+ magic=$(get_magic_at $mtddev 20480)
+ [ "$magic" != "a55a" ] && return 0
+
+ return 1
+}
+
+dir825b_copy_caldata() {
+ local cal_src=$1
+ local cal_dst=$2
+ local mtd_src
+ local mtd_dst
+ local md5_src
+ local md5_dst
+
+ mtd_src=$(find_mtd_part $cal_src)
+ [ -z "$mtd_src" ] && {
+ echo "no $cal_src partition found"
+ return 1
+ }
+
+ mtd_dst=$(find_mtd_part $cal_dst)
+ [ -z "$mtd_dst" ] && {
+ echo "no $cal_dst partition found"
+ return 1
+ }
+
+ dir825b_is_caldata_valid "$mtd_src" && {
+ echo "no valid calibration data found in $cal_src"
+ return 1
+ }
+
+ dir825b_is_caldata_valid "$mtd_dst" && {
+ echo "Copying calibration data from $cal_src to $cal_dst..."
+ dd if="$mtd_src" 2>/dev/null | mtd -q -q write - "$cal_dst"
+ }
+
+ md5_src=$(md5sum "$mtd_src") && md5_src="${md5_src%% *}"
+ md5_dst=$(md5sum "$mtd_dst") && md5_dst="${md5_dst%% *}"
+
+ [ "$md5_src" != "$md5_dst" ] && {
+ echo "calibration data mismatch $cal_src:$md5_src $cal_dst:$md5_dst"
+ return 1
+ }
+
+ return 0
+}
+
+dir825b_do_upgrade_combined() {
+ local fw_part=$1
+ local fw_file=$2
+ local fw_mtd=$(find_mtd_part $fw_part)
+ local fw_length=0x$(dd if="$fw_file" bs=2 skip=1 count=4 2>/dev/null)
+ local fw_blocks=$(($fw_length / 65536))
+
+ if [ -n "$fw_mtd" ] && [ ${fw_blocks:-0} -gt 0 ]; then
+ local append=""
+ [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR"
+
+ sync
+ dd if="$fw_file" bs=64k skip=1 count=$fw_blocks 2>/dev/null | \
+ mtd $append write - "$fw_part"
+ fi
+}
+
+dir825b_check_image() {
+ local magic="$(get_magic_long "$1")"
+ local fw_mtd=$(find_mtd_part "firmware_orig")
+
+ case "$magic" in
+ "27051956")
+ ;;
+ "43493030")
+ local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null)
+ local md5_chk=$(dd if="$1" bs=64k skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}"
+ local fw_len=$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null)
+ local fw_part_len=$(get_mtd_part_size "firmware")
+
+ if [ -z "$fw_mtd" ]; then
+ ask_bool 0 "Do you have a backup of the caldata partition?" || {
+ echo "Warning, please make sure that you have a backup of the caldata partition."
+ echo "Once you have that, use 'sysupgrade -i' for upgrading to the 'fat' firmware."
+ return 1
+ }
+ fi
+
+ if [ -z "$md5_img" -o -z "$md5_chk" ]; then
+ echo "Unable to get image checksums. Maybe you are using a streamed image?"
+ return 1
+ fi
+
+ if [ "$md5_img" != "$md5_chk" ]; then
+ echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)"
+ return 1
+ fi
+
+ fw_len=$((0x$fw_len))
+ fw_part_len=${fw_part_len:-0}
+
+ if [ $fw_part_len -lt $fw_len ]; then
+ echo "The upgrade image is too big (size:$fw_len available:$fw_part_len)"
+ return 1
+ fi
+ ;;
+ *)
+ echo "Unsupported image format."
+ return 1
+ ;;
+ esac
+
+ return 0
+}
+
+platform_do_upgrade_dir825b() {
+ local magic="$(get_magic_long "$1")"
+ local fw_mtd=$(find_mtd_part "firmware_orig")
+
+ case "$magic" in
+ "27051956")
+ if [ -n "$fw_mtd" ]; then
+ # restore calibration data before downgrading to
+ # the normal image
+ dir825b_copy_caldata "caldata" "caldata_orig" || {
+ echo "unable to restore calibration data"
+ exit 1
+ }
+ PART_NAME="firmware_orig"
+ else
+ PART_NAME="firmware"
+ fi
+ default_do_upgrade "$ARGV"
+ ;;
+ "43493030")
+ if [ -z "$fw_mtd" ]; then
+ # backup calibration data before upgrading to the
+ # fat image
+ dir825b_copy_caldata "caldata" "caldata_copy" || {
+ echo "unable to backup calibration data"
+ exit 1
+ }
+ fi
+ dir825b_do_upgrade_combined "firmware" "$ARGV"
+ ;;
+ esac
+}
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/om2p.sh b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh
index d9a8bbb7f..5179875fe 100644
--- a/target/linux/ar71xx/base-files/lib/upgrade/om2p.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh
@@ -1,9 +1,9 @@
-# The U-Boot loader of the OM2P requires image sizes and checksums to be
-# provided in the U-Boot environment.
-# The OM2P comes with 2 main partitions - while one is active sysupgrade
-# will flash the other. The boot order is changed to boot the newly
-# flashed partition. If the new partition can't be booted due to upgrade
-# failures the previously used partition is loaded.
+# The U-Boot loader of the OpenMesh devices requires image sizes and
+# checksums to be provided in the U-Boot environment.
+# The OpenMesh devices come with 2 main partitions - while one is active
+# sysupgrade will flash the other. The boot order is changed to boot the
+# newly flashed partition. If the new partition can't be booted due to
+# upgrade failures the previously used partition is loaded.
trim()
{
@@ -34,7 +34,7 @@ platform_add_ramfs_ubootenv()
}
append sysupgrade_pre_upgrade platform_add_ramfs_ubootenv
-platform_check_image_om2p()
+platform_check_image_openmesh()
{
local img_magic=$1
local img_path=$2
@@ -56,6 +56,17 @@ platform_check_image_om2p()
case "$img_board_target" in
OM2P)
+ [ "$board" = "om2p" ] && break
+ [ "$board" = "om2p-lc" ] && break
+ [ "$board" = "om2p-hs" ] && break
+ echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform"
+ return 1
+ ;;
+ MR600)
+ [ "$board" = "mr600" ] && break
+ [ "$board" = "mr600v2" ] && break
+ echo "Invalid image board target ($img_board_target) for this platform: $board. Use the correct image for this platform"
+ return 1
;;
*)
echo "Invalid board target ($img_board_target). Use the correct image for this platform"
@@ -102,13 +113,14 @@ platform_check_image_om2p()
return 0
}
-platform_do_upgrade_om2p()
+platform_do_upgrade_openmesh()
{
- local img_path=$1
- local kernel_start_addr= kernel_size= kernel_md5=
+ local img_path=$1 img_board_target=
+ local kernel_start_addr= kernel_start_addr1= kernel_start_addr2=
+ local kernel_size= kernel_md5=
local rootfs_size= rootfs_checksize= rootfs_md5=
- local kernel_bsize= total_size=7340032
- local data_offset=$((64 * 1024)) block_size=$((256 * 1024)) offset=
+ local kernel_bsize= total_size=
+ local data_offset=$((64 * 1024)) block_size= offset=
local uboot_env_upgrade="/tmp/fw_env_upgrade"
local cfg_size= kernel_size= rootfs_size=
local append=""
@@ -119,8 +131,24 @@ platform_do_upgrade_om2p()
kernel_size=$(dd if="$img_path" bs=2 skip=71 count=4 2>/dev/null)
rootfs_size=$(dd if="$img_path" bs=2 skip=107 count=4 2>/dev/null)
+ img_board_target=$(trim $(dd if="$img_path" bs=4 skip=1 count=8 2>/dev/null))
cfg_content=$(dd if="$img_path" bs=1 skip=$data_offset count=$(echo $((0x$cfg_size))) 2>/dev/null)
+ case $img_board_target in
+ OM2P)
+ block_size=$((256 * 1024))
+ total_size=7340032
+ kernel_start_addr1=0x9f1c0000
+ kernel_start_addr2=0x9f8c0000
+ ;;
+ MR600)
+ block_size=$((64 * 1024))
+ total_size=7995392
+ kernel_start_addr1=0x9f0b0000
+ kernel_start_addr2=0x9f850000
+ ;;
+ esac
+
kernel_md5=$(cfg_value_get "$cfg_content" "vmlinux" "md5sum")
rootfs_md5=$(cfg_value_get "$cfg_content" "rootfs" "md5sum")
rootfs_checksize=$(cfg_value_get "$cfg_content" "rootfs" "checksize")
@@ -147,12 +175,12 @@ platform_do_upgrade_om2p()
printf "kernel_size_1 %u\n" $(($kernel_bsize / 1024)) >> $uboot_env_upgrade
printf "rootfs_size_1 %u\n" $((($total_size - $kernel_bsize) / 1024)) >> $uboot_env_upgrade
printf "bootseq 1,2\n" >> $uboot_env_upgrade
- kernel_start_addr=0x9f1c0000
+ kernel_start_addr=$kernel_start_addr1
else
printf "kernel_size_2 %u\n" $(($kernel_bsize / 1024)) >> $uboot_env_upgrade
printf "rootfs_size_2 %u\n" $((($total_size - $kernel_bsize) / 1024)) >> $uboot_env_upgrade
printf "bootseq 2,1\n" >> $uboot_env_upgrade
- kernel_start_addr=0x9f8c0000
+ kernel_start_addr=$kernel_start_addr2
fi
printf "vmlinux_start_addr %s\n" $kernel_start_addr >> $uboot_env_upgrade
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 2992aed32..817123b6d 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -15,7 +15,7 @@ platform_find_partitions() {
while read dev size erasesize name; do
name=${name#'"'}; name=${name%'"'}
case "$name" in
- vmlinux.bin.l7|vmlinux|kernel|linux|rootfs|filesystem)
+ vmlinux.bin.l7|vmlinux|kernel|linux|linux.bin|rootfs|filesystem)
if [ -z "$first" ]; then
first="$name"
else
@@ -31,7 +31,7 @@ platform_find_kernelpart() {
local part
for part in "${1%:*}" "${1#*:}"; do
case "$part" in
- vmlinux.bin.l7|vmlinux|kernel|linux)
+ vmlinux.bin.l7|vmlinux|kernel|linux|linux.bin)
echo "$part"
break
;;
@@ -65,6 +65,10 @@ tplink_get_image_hwid() {
get_image "$@" | dd bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
}
+tplink_get_image_boot_size() {
+ get_image "$@" | dd bs=4 count=1 skip=37 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
platform_check_image() {
local board=$(ar71xx_board_name)
local magic="$(get_magic_word "$1")"
@@ -74,7 +78,8 @@ platform_check_image() {
case "$board" in
all0315n | \
- all0258n )
+ all0258n | \
+ cap4200ag)
platform_check_image_allnet "$1" && return 0
return 1
;;
@@ -83,7 +88,9 @@ platform_check_image() {
ap113 | \
ap121 | \
ap121-mini | \
- ap136 | \
+ ap136-010 | \
+ ap136-020 | \
+ ap135-020 | \
ap96 | \
db120 | \
hornet-ub | \
@@ -97,18 +104,17 @@ platform_check_image() {
;;
ap81 | \
ap83 | \
+ ap132 | \
dir-600-a1 | \
dir-615-c1 | \
dir-615-e4 | \
- dir-825-b1 | \
- dir-825-b1-openwrt | \
- dir-825-b1-tostock | \
+ dir-825-c1 | \
+ dir-835-a1 | \
ew-dorin | \
ew-dorin-router | \
mzk-w04nu | \
mzk-w300nh | \
tew-632brp | \
- tew-673gru | \
tew-712br | \
wrt400n | \
airrouter | \
@@ -116,6 +122,7 @@ platform_check_image() {
nanostation-m | \
rocket-m | \
rw2458n | \
+ wndap360 | \
wzr-hp-g300nh2 | \
wzr-hp-g300nh | \
wzr-hp-g450h | \
@@ -125,30 +132,47 @@ platform_check_image() {
whr-hp-gn | \
wlae-ag300n | \
nbg460n_550n_550nh | \
- unifi )
+ unifi | \
+ unifi-outdoor )
[ "$magic" != "2705" ] && {
echo "Invalid image type."
return 1
}
return 0
;;
+
+ dir-825-b1 | \
+ tew-673gru)
+ dir825b_check_image "$1" && return 0
+ ;;
+
+ mr600 | \
+ mr600v2 | \
om2p | \
+ om2p-hs | \
om2p-lc)
- platform_check_image_om2p "$magic_long" "$1" && return 0
+ platform_check_image_openmesh "$magic_long" "$1" && return 0
return 1
;;
tl-mr11u | \
tl-mr3020 | \
+ tl-mr3040 | \
tl-mr3220 | \
+ tl-mr3220-v2 | \
tl-mr3420 | \
+ tl-mr3420-v2 | \
+ tl-wa7510n | \
tl-wa901nd | \
tl-wa901nd-v2 | \
+ tl-wdr3500 | \
tl-wdr4300 | \
tl-wr703n | \
+ tl-wr720n-v3 | \
tl-wr741nd | \
tl-wr741nd-v4 | \
tl-wr841n-v1 | \
tl-wr841n-v7 | \
+ tl-wr841n-v8 | \
tl-wr941nd | \
tl-wr1041n-v2 | \
tl-wr1043nd | \
@@ -169,6 +193,21 @@ platform_check_image() {
return 1
}
+ local boot_size
+
+ boot_size=$(tplink_get_image_boot_size "$1")
+ [ "$boot_size" != "00000000" ] && {
+ echo "Invalid image, it contains a bootloader."
+ return 1
+ }
+
+ return 0
+ ;;
+ uap-pro)
+ [ "$magic_long" != "19852003" ] && {
+ echo "Invalid image type."
+ return 1
+ }
return 0
;;
wndr3700)
@@ -196,7 +235,8 @@ platform_check_image() {
all0305 | \
eap7660d | \
ja76pf | \
- ja76pf2)
+ ja76pf2 | \
+ jwap003)
[ "$magic" != "4349" ] && {
echo "Invalid image. Use *-sysupgrade.bin files on this board"
return 1
@@ -231,7 +271,8 @@ platform_do_upgrade() {
pb42 | \
pb44 | \
ja76pf | \
- ja76pf2)
+ ja76pf2 | \
+ jwap003)
platform_do_upgrade_combined "$ARGV"
;;
all0258n )
@@ -240,9 +281,19 @@ platform_do_upgrade() {
all0315n )
platform_do_upgrade_allnet "0x9f080000" "$ARGV"
;;
+ cap4200ag)
+ platform_do_upgrade_allnet "0xbf0a0000" "$ARGV"
+ ;;
+ dir-825-b1 |\
+ tew-673gru)
+ platform_do_upgrade_dir825b "$ARGV"
+ ;;
+ mr600 | \
+ mr600v2 | \
om2p | \
+ om2p-hs | \
om2p-lc)
- platform_do_upgrade_om2p "$ARGV"
+ platform_do_upgrade_openmesh "$ARGV"
;;
*)
default_do_upgrade "$ARGV"
diff --git a/target/linux/ar71xx/base-files/sbin/wget2nand b/target/linux/ar71xx/base-files/sbin/wget2nand
index 9cd6e7c40..f80eecd21 100755
--- a/target/linux/ar71xx/base-files/sbin/wget2nand
+++ b/target/linux/ar71xx/base-files/sbin/wget2nand
@@ -6,7 +6,7 @@
# Licence GPL V2
# Author david.goodenough@linkchoose.co.uk
# Based on cf2nand from RB532 support
-. /etc/functions.sh
+. /lib/functions.sh
wget2nand_dir=/tmp/wget2nand
mnt_kernel=$wget2nand_dir/mnt_kernel
@@ -27,7 +27,7 @@ url=$1
exit 1
}
-url_kernel=$url/openwrt-ar71xx-nand-vmlinux.elf
+url_kernel=$url/openwrt-ar71xx-nand-vmlinux-lzma.elf
url_rootfs=$url/openwrt-ar71xx-nand-rootfs.tar.gz
mtd_kernel="$(find_mtd_part 'kernel')"