aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2019-10-22 21:46:57 +0200
committerJohn Crispin <john@phrozen.org>2019-10-27 14:24:22 +0100
commit0130022baec0a90c6cb039a5cbe9b9c65c01672f (patch)
tree93815b43aaf2d13863c0beb78e95cf443c29606a /target/linux/ath79
parentc36ef5970b0342f01f1f3bfc7452b86992c7201b (diff)
downloadupstream-0130022baec0a90c6cb039a5cbe9b9c65c01672f.tar.gz
upstream-0130022baec0a90c6cb039a5cbe9b9c65c01672f.tar.bz2
upstream-0130022baec0a90c6cb039a5cbe9b9c65c01672f.zip
ath79: split base-files into subtargets
While most of the target's contents are split into subtargets, the base-files are maintained for the target as a whole. However, OpenWrt already implements a mechanism that will use (and even prefer) files in the subtargets' directories. This can be exploited to make several scripts subtarget-specific and thus save some space (especially helpful for the tiny devices). The only script remaining in parent base-files is /etc/hotplug.d/ieee80211/00-wifi-migration, everything else is moved/split. Note that this will increase overall code lines, but reduce code per subtarget. base-files ipk size reduction: master (generic) 49135 B split (generic) 48533 B (- 0.6 kiB) split (tiny) 43337 B (- 5.7 kiB) split (nand) 44423 B (- 4.6 kiB) Tested on TL-WR1043ND v4 (generic) and TL-WR841N v12 (tiny). Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/ath79')
-rwxr-xr-xtarget/linux/ath79/generic/base-files/etc/board.d/01_leds (renamed from target/linux/ath79/base-files/etc/board.d/01_leds)59
-rwxr-xr-xtarget/linux/ath79/generic/base-files/etc/board.d/02_network (renamed from target/linux/ath79/base-files/etc/board.d/02_network)50
-rwxr-xr-xtarget/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches (renamed from target/linux/ath79/base-files/etc/board.d/03_gpio_switches)0
-rw-r--r--target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom (renamed from target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom)19
-rw-r--r--target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata (renamed from target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata)0
-rw-r--r--target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac (renamed from target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac)0
-rwxr-xr-xtarget/linux/ath79/generic/base-files/etc/init.d/bootcount (renamed from target/linux/ath79/base-files/etc/init.d/bootcount)0
-rw-r--r--target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration (renamed from target/linux/ath79/base-files/etc/uci-defaults/04_led_migration)0
-rw-r--r--target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum (renamed from target/linux/ath79/base-files/etc/uci-defaults/09_fix-checksum)0
-rwxr-xr-xtarget/linux/ath79/generic/base-files/lib/functions/k2t.sh (renamed from target/linux/ath79/base-files/lib/functions/k2t.sh)0
-rw-r--r--target/linux/ath79/generic/base-files/lib/upgrade/platform.sh (renamed from target/linux/ath79/base-files/lib/upgrade/platform.sh)0
-rwxr-xr-xtarget/linux/ath79/nand/base-files/etc/board.d/01_leds18
-rwxr-xr-xtarget/linux/ath79/nand/base-files/etc/board.d/02_network35
-rw-r--r--target/linux/ath79/nand/base-files/lib/upgrade/platform.sh20
-rwxr-xr-xtarget/linux/ath79/tiny/base-files/etc/board.d/01_leds85
-rwxr-xr-xtarget/linux/ath79/tiny/base-files/etc/board.d/02_network96
-rw-r--r--target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom38
-rw-r--r--target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh20
18 files changed, 314 insertions, 126 deletions
diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 499fe0031c..e3575ff041 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -28,13 +28,6 @@ avm,fritz4020)
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x1E"
;;
-buffalo,whr-g301n)
- ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
- ucidef_set_led_switch "lan1" "LAN1" "$boardname:green:lan1" "switch0" "0x02"
- ucidef_set_led_switch "lan2" "LAN2" "$boardname:green:lan2" "switch0" "0x04"
- ucidef_set_led_switch "lan3" "LAN3" "$boardname:green:lan3" "switch0" "0x08"
- ucidef_set_led_switch "lan4" "LAN4" "$boardname:green:lan4" "switch0" "0x10"
- ;;
comfast,cf-e110n-v2)
ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1"
ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x02"
@@ -101,7 +94,6 @@ glinet,gl-ar150)
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x02"
;;
-glinet,gl-ar300m-nand|\
glinet,gl-ar300m-nor)
ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth0"
;;
@@ -111,24 +103,6 @@ glinet,gl-ar300m-lite)
glinet,gl-x750)
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
;;
-netgear,wnr1000-v2|\
-netgear,wnr2000-v3)
- ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
- ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
- ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
- ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
- ucidef_set_led_switch "lan4green" "LAN4 (green)" "netgear:green:lan4" "switch0" "0x10" "0x04"
- ucidef_set_led_switch "lan1amber" "LAN1 (amber)" "netgear:amber:lan1" "switch0" "0x02" "0x02"
- ucidef_set_led_switch "lan2amber" "LAN2 (amber)" "netgear:amber:lan2" "switch0" "0x04" "0x02"
- ucidef_set_led_switch "lan3amber" "LAN3 (amber)" "netgear:amber:lan3" "switch0" "0x08" "0x02"
- ucidef_set_led_switch "lan4amber" "LAN4 (amber)" "netgear:amber:lan4" "switch0" "0x10" "0x02"
- ;;
-netgear,wnr612-v2|\
-on,n150r)
- ucidef_set_led_netdev "wan" "WAN" "netgear:green:wan" "eth0"
- ucidef_set_led_switch "lan1" "LAN1" "netgear:green:lan1" "switch0" "0x02" "0x0f"
- ucidef_set_led_switch "lan2" "LAN2" "netgear:green:lan2" "switch0" "0x04" "0x0f"
- ;;
pcs,cap324)
ucidef_set_led_netdev "lan" "LAN" "pcs:lan:green" "eth0"
;;
@@ -165,10 +139,6 @@ tplink,archer-c6-v2)
ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x02"
;;
tplink,archer-c25-v1|\
-tplink,tl-wr841-v9|\
-tplink,tl-wr841-v10|\
-tplink,tl-wr841-v11|\
-tplink,tl-wr841-v12|\
tplink,tl-wr842n-v3)
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
@@ -227,14 +197,6 @@ tplink,re450-v2)
ucidef_set_led_netdev "lan_data" "LAN Data" "tp-link:green:lan_data" "eth0" "tx rx"
ucidef_set_led_netdev "lan_link" "LAN Link" "tp-link:green:lan_link" "eth0" "link"
;;
-tplink,tl-mr3020-v1|\
-tplink,tl-mr3040-v2)
- ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
- ;;
-tplink,tl-mr3420-v2|\
-tplink,tl-wr740n-v4|\
-tplink,tl-wr741nd-v4|\
-tplink,tl-wr841-v8|\
tplink,tl-wr842n-v2)
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x04"
@@ -242,27 +204,6 @@ tplink,tl-wr842n-v2)
ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x10"
ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
;;
-tplink,tl-wr740n-v1|\
-tplink,tl-wr740n-v3|\
-tplink,tl-wr741-v1|\
-tplink,tl-wr743nd-v1|\
-tplink,tl-wr841-v5|\
-tplink,tl-wr941-v4)
- ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
- ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02"
- ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04"
- ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08"
- ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10"
- ;;
-tplink,tl-wr940n-v3|\
-tplink,tl-wr940n-v4|\
-tplink,tl-wr941nd-v6)
- ucidef_set_led_netdev "wan" "WAN" "tp-link:blue:wan" "eth1"
- ucidef_set_led_switch "lan1" "LAN1" "tp-link:blue:lan1" "switch0" "0x10"
- ucidef_set_led_switch "lan2" "LAN2" "tp-link:blue:lan2" "switch0" "0x08"
- ucidef_set_led_switch "lan3" "LAN3" "tp-link:blue:lan3" "switch0" "0x04"
- ucidef_set_led_switch "lan4" "LAN4" "tp-link:blue:lan4" "switch0" "0x02"
- ;;
trendnet,tew-823dru)
ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
;;
diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index b5209f7014..7507c6584c 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -28,7 +28,6 @@ ath79_setup_interfaces()
pisen,ts-d084|\
pisen,wmb001n|\
pisen,wmm003n|\
- pqi,air-pen|\
tplink,cpe210-v2|\
tplink,cpe210-v3|\
tplink,cpe510-v2|\
@@ -38,11 +37,6 @@ ath79_setup_interfaces()
tplink,re355-v1|\
tplink,re450-v1|\
tplink,re450-v2|\
- tplink,tl-mr10u|\
- tplink,tl-mr3020-v1|\
- tplink,tl-mr3040-v2|\
- tplink,tl-wa901nd-v2|\
- tplink,tl-wr703n|\
ubnt,bullet-m|\
ubnt,bullet-m-xw|\
ubnt,lap-120|\
@@ -76,26 +70,11 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
;;
- buffalo,whr-g301n)
- ucidef_set_interface_wan "eth0"
- ucidef_add_switch "switch0" \
- "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
- ;;
buffalo,wzr-hp-ag300h|\
tplink,archer-c25-v1|\
- tplink,tl-mr3220-v1|\
- tplink,tl-mr3420-v1|\
tplink,tl-wdr3500-v1|\
- tplink,tl-wr841-v7|\
- tplink,tl-wr841-v9|\
- tplink,tl-wr841-v10|\
- tplink,tl-wr841-v11|\
- tplink,tl-wr841-v12|\
tplink,tl-wr842n-v1|\
tplink,tl-wr842n-v3|\
- tplink,tl-wr940n-v3|\
- tplink,tl-wr940n-v4|\
- tplink,tl-wr941nd-v6|\
ubnt,airrouter)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
@@ -205,20 +184,6 @@ ath79_setup_interfaces()
ucidef_add_switch_port_attr "switch0" 2 led 9
ucidef_add_switch_port_attr "switch0" 5 led 2
;;
- netgear,wnr1000-v2|\
- netgear,wnr2000-v3|\
- netgear,wnr612-v2|\
- on,n150r|\
- tplink,tl-wr740n-v1|\
- tplink,tl-wr740n-v3|\
- tplink,tl-wr741-v1|\
- tplink,tl-wr743nd-v1|\
- tplink,tl-wr841-v5|\
- tplink,tl-wr941-v4)
- ucidef_set_interface_wan "eth0"
- ucidef_add_switch "switch0" \
- "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
- ;;
phicomm,k2t)
ucidef_add_switch "switch0" \
"0@eth0" "3:lan:1" "5:lan:2" "4:wan"
@@ -237,8 +202,7 @@ ath79_setup_interfaces()
tplink,archer-c7-v4|\
tplink,archer-c7-v5|\
tplink,tl-wdr3600-v1|\
- tplink,tl-wdr4300-v1|\
- tplink,tl-wr941n-v7-cn)
+ tplink,tl-wdr4300-v1)
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
;;
@@ -259,10 +223,6 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
;;
- tplink,tl-mr3420-v2|\
- tplink,tl-wr740n-v4|\
- tplink,tl-wr741nd-v4|\
- tplink,tl-wr841-v8|\
tplink,tl-wr842n-v2)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
@@ -281,9 +241,6 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
;;
- tplink,tl-wr941-v2)
- ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
- ;;
ubnt,acb-isp)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
@@ -429,11 +386,6 @@ ath79_setup_macs()
base_mac=$(mtd_get_mac_binary info 0x8)
wan_mac=$(macaddr_add "$base_mac" 1)
;;
- tplink,tl-wr941-v2|\
- tplink,tl-wr941n-v7-cn)
- base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
- wan_mac=$(macaddr_add "$base_mac" 1)
- ;;
trendnet,tew-823dru)
lan_mac=$(mtd_get_mac_text mac 0x4)
wan_mac=$(mtd_get_mac_text mac 0x18)
diff --git a/target/linux/ath79/base-files/etc/board.d/03_gpio_switches b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches
index d84d6cfe85..d84d6cfe85 100755
--- a/target/linux/ath79/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 14cfe64a41..f1bc6c3c22 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -61,10 +61,7 @@ case "$FIRMWARE" in
avm,fritz300e)
caldata_extract_reverse "urloader" 0x1541 0x440
;;
- buffalo,whr-g301n|\
- buffalo,wzr-hp-g302h-a1a0|\
- tplink,tl-wr841-v5|\
- tplink,tl-wr941-v4)
+ buffalo,wzr-hp-g302h-a1a0)
caldata_extract "art" 0x1000 0xeb8
;;
buffalo,wzr-hp-g450h)
@@ -83,19 +80,8 @@ case "$FIRMWARE" in
winchannel,wb2000)
caldata_extract "art" 0x5000 0x440
;;
- netgear,wnr1000-v2|\
- netgear,wnr2000-v3|\
- netgear,wnr612-v2|\
- on,n150r|\
pcs,cap324|\
- tplink,tl-mr3220-v1|\
- tplink,tl-mr3420-v1|\
tplink,tl-wr2543-v1|\
- tplink,tl-wr740n-v1|\
- tplink,tl-wr740n-v3|\
- tplink,tl-wr741-v1|\
- tplink,tl-wr743nd-v1|\
- tplink,tl-wr841-v7|\
tplink,tl-wr842n-v1|\
ubnt,airrouter|\
ubnt,bullet-m|\
@@ -103,9 +89,6 @@ case "$FIRMWARE" in
ubnt,rocket-m)
caldata_extract "art" 0x1000 0x1000
;;
- pqi,air-pen)
- caldata_extract "art" 0x1000 0x7d2
- ;;
ubnt,unifi)
caldata_extract "art" 0x1000 0x800
;;
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 91e813f121..91e813f121 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 8c8b7932bc..8c8b7932bc 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
diff --git a/target/linux/ath79/base-files/etc/init.d/bootcount b/target/linux/ath79/generic/base-files/etc/init.d/bootcount
index 7807559d81..7807559d81 100755
--- a/target/linux/ath79/base-files/etc/init.d/bootcount
+++ b/target/linux/ath79/generic/base-files/etc/init.d/bootcount
diff --git a/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration
index b23e5f7db6..b23e5f7db6 100644
--- a/target/linux/ath79/base-files/etc/uci-defaults/04_led_migration
+++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/04_led_migration
diff --git a/target/linux/ath79/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum
index 22c9483e74..22c9483e74 100644
--- a/target/linux/ath79/base-files/etc/uci-defaults/09_fix-checksum
+++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum
diff --git a/target/linux/ath79/base-files/lib/functions/k2t.sh b/target/linux/ath79/generic/base-files/lib/functions/k2t.sh
index 1158df818b..1158df818b 100755
--- a/target/linux/ath79/base-files/lib/functions/k2t.sh
+++ b/target/linux/ath79/generic/base-files/lib/functions/k2t.sh
diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
index 83c4e78d25..83c4e78d25 100644
--- a/target/linux/ath79/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/01_leds b/target/linux/ath79/nand/base-files/etc/board.d/01_leds
new file mode 100755
index 0000000000..59c35ed828
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/etc/board.d/01_leds
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+board=$(board_name)
+boardname="${board##*,}"
+
+case "$board" in
+glinet,gl-ar300m-nand)
+ ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth0"
+ ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network
new file mode 100755
index 0000000000..65ce439545
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+. /lib/functions/system.sh
+. /lib/functions/uci-defaults.sh
+
+ath79_setup_interfaces()
+{
+ local board="$1"
+
+ case "$board" in
+ *)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ;;
+ esac
+}
+
+ath79_setup_macs()
+{
+ local board="$1"
+
+ case "$board" in
+ esac
+
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+}
+
+board_config_update
+board=$(board_name)
+ath79_setup_interfaces $board
+ath79_setup_macs $board
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
new file mode 100644
index 0000000000..b02ab9a080
--- /dev/null
+++ b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+PART_NAME=firmware
+REQUIRE_IMAGE_METADATA=1
+
+platform_check_image() {
+ return 0
+}
+
+platform_do_upgrade() {
+ local board=$(board_name)
+
+ case "$board" in
+ *)
+ default_do_upgrade "$1"
+ ;;
+ esac
+}
diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/01_leds b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds
new file mode 100755
index 0000000000..bb1799c645
--- /dev/null
+++ b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+. /lib/functions/uci-defaults.sh
+
+board_config_update
+
+board=$(board_name)
+boardname="${board##*,}"
+
+case "$board" in
+buffalo,whr-g301n)
+ ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "$boardname:green:lan1" "switch0" "0x02"
+ ucidef_set_led_switch "lan2" "LAN2" "$boardname:green:lan2" "switch0" "0x04"
+ ucidef_set_led_switch "lan3" "LAN3" "$boardname:green:lan3" "switch0" "0x08"
+ ucidef_set_led_switch "lan4" "LAN4" "$boardname:green:lan4" "switch0" "0x10"
+ ;;
+netgear,wnr1000-v2|\
+netgear,wnr2000-v3)
+ ucidef_set_led_netdev "wan-amber" "WAN (amber)" "netgear:amber:wan" "eth0"
+ ucidef_set_led_switch "lan1green" "LAN1 (green)" "netgear:green:lan1" "switch0" "0x02" "0x04"
+ ucidef_set_led_switch "lan2green" "LAN2 (green)" "netgear:green:lan2" "switch0" "0x04" "0x04"
+ ucidef_set_led_switch "lan3green" "LAN3 (green)" "netgear:green:lan3" "switch0" "0x08" "0x04"
+ ucidef_set_led_switch "lan4green" "LAN4 (green)" "netgear:green:lan4" "switch0" "0x10" "0x04"
+ ucidef_set_led_switch "lan1amber" "LAN1 (amber)" "netgear:amber:lan1" "switch0" "0x02" "0x02"
+ ucidef_set_led_switch "lan2amber" "LAN2 (amber)" "netgear:amber:lan2" "switch0" "0x04" "0x02"
+ ucidef_set_led_switch "lan3amber" "LAN3 (amber)" "netgear:amber:lan3" "switch0" "0x08" "0x02"
+ ucidef_set_led_switch "lan4amber" "LAN4 (amber)" "netgear:amber:lan4" "switch0" "0x10" "0x02"
+ ;;
+netgear,wnr612-v2|\
+on,n150r)
+ ucidef_set_led_netdev "wan" "WAN" "netgear:green:wan" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "netgear:green:lan1" "switch0" "0x02" "0x0f"
+ ucidef_set_led_switch "lan2" "LAN2" "netgear:green:lan2" "switch0" "0x04" "0x0f"
+ ;;
+tplink,tl-wr841-v9|\
+tplink,tl-wr841-v10|\
+tplink,tl-wr841-v11|\
+tplink,tl-wr841-v12)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
+ ;;
+tplink,tl-mr3020-v1|\
+tplink,tl-mr3040-v2)
+ ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
+ ;;
+tplink,tl-mr3420-v2|\
+tplink,tl-wr740n-v4|\
+tplink,tl-wr741nd-v4|\
+tplink,tl-wr841-v8)
+ 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"
+ ;;
+tplink,tl-wr740n-v1|\
+tplink,tl-wr740n-v3|\
+tplink,tl-wr741-v1|\
+tplink,tl-wr743nd-v1|\
+tplink,tl-wr841-v5|\
+tplink,tl-wr941-v4)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x02"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:green:lan2" "switch0" "0x04"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x08"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x10"
+ ;;
+tplink,tl-wr940n-v3|\
+tplink,tl-wr940n-v4|\
+tplink,tl-wr941nd-v6)
+ ucidef_set_led_netdev "wan" "WAN" "tp-link:blue:wan" "eth1"
+ ucidef_set_led_switch "lan1" "LAN1" "tp-link:blue:lan1" "switch0" "0x10"
+ ucidef_set_led_switch "lan2" "LAN2" "tp-link:blue:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "tp-link:blue:lan3" "switch0" "0x04"
+ ucidef_set_led_switch "lan4" "LAN4" "tp-link:blue:lan4" "switch0" "0x02"
+ ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/02_network b/target/linux/ath79/tiny/base-files/etc/board.d/02_network
new file mode 100755
index 0000000000..49fccc0b2e
--- /dev/null
+++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+. /lib/functions/system.sh
+. /lib/functions/uci-defaults.sh
+
+ath79_setup_interfaces()
+{
+ local board="$1"
+
+ case "$board" in
+ pqi,air-pen|\
+ tplink,tl-mr10u|\
+ tplink,tl-mr3020-v1|\
+ tplink,tl-mr3040-v2|\
+ tplink,tl-wa901nd-v2|\
+ tplink,tl-wr703n)
+ ucidef_set_interface_lan "eth0"
+ ;;
+ buffalo,whr-g301n)
+ ucidef_set_interface_wan "eth0"
+ ucidef_add_switch "switch0" \
+ "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
+ ;;
+ tplink,tl-mr3220-v1|\
+ tplink,tl-mr3420-v1|\
+ tplink,tl-wr841-v7|\
+ tplink,tl-wr841-v9|\
+ tplink,tl-wr841-v10|\
+ tplink,tl-wr841-v11|\
+ tplink,tl-wr841-v12|\
+ tplink,tl-wr940n-v3|\
+ tplink,tl-wr940n-v4|\
+ tplink,tl-wr941nd-v6)
+ ucidef_set_interface_wan "eth1"
+ ucidef_add_switch "switch0" \
+ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
+ ;;
+ netgear,wnr1000-v2|\
+ netgear,wnr2000-v3|\
+ netgear,wnr612-v2|\
+ on,n150r|\
+ tplink,tl-wr740n-v1|\
+ tplink,tl-wr740n-v3|\
+ tplink,tl-wr741-v1|\
+ tplink,tl-wr743nd-v1|\
+ tplink,tl-wr841-v5|\
+ tplink,tl-wr941-v4)
+ ucidef_set_interface_wan "eth0"
+ ucidef_add_switch "switch0" \
+ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan"
+ ;;
+ tplink,tl-wr941n-v7-cn)
+ ucidef_add_switch "switch0" \
+ "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
+ ;;
+ tplink,tl-mr3420-v2|\
+ tplink,tl-wr740n-v4|\
+ tplink,tl-wr741nd-v4|\
+ tplink,tl-wr841-v8)
+ ucidef_set_interface_wan "eth1"
+ ucidef_add_switch "switch0" \
+ "0@eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
+ ;;
+ tplink,tl-wr941-v2)
+ ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
+ ;;
+ *)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ;;
+ esac
+}
+
+ath79_setup_macs()
+{
+ local board="$1"
+
+ case "$board" in
+ tplink,tl-wr941-v2|\
+ tplink,tl-wr941n-v7-cn)
+ base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
+ wan_mac=$(macaddr_add "$base_mac" 1)
+ ;;
+ esac
+
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+}
+
+board_config_update
+board=$(board_name)
+ath79_setup_interfaces $board
+ath79_setup_macs $board
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
new file mode 100644
index 0000000000..3da95cc161
--- /dev/null
+++ b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions/caldata.sh
+
+board=$(board_name)
+
+case "$FIRMWARE" in
+"ath9k-eeprom-pci-0000:00:00.0.bin")
+ case $board in
+ buffalo,whr-g301n|\
+ tplink,tl-wr841-v5|\
+ tplink,tl-wr941-v4)
+ caldata_extract "art" 0x1000 0xeb8
+ ;;
+ netgear,wnr1000-v2|\
+ netgear,wnr2000-v3|\
+ netgear,wnr612-v2|\
+ on,n150r|\
+ tplink,tl-mr3220-v1|\
+ tplink,tl-mr3420-v1|\
+ tplink,tl-wr740n-v1|\
+ tplink,tl-wr740n-v3|\
+ tplink,tl-wr741-v1|\
+ tplink,tl-wr743nd-v1|\
+ tplink,tl-wr841-v7)
+ caldata_extract "art" 0x1000 0x1000
+ ;;
+ pqi,air-pen)
+ caldata_extract "art" 0x1000 0x7d2
+ ;;
+ *)
+ caldata_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh
new file mode 100644
index 0000000000..b02ab9a080
--- /dev/null
+++ b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+
+PART_NAME=firmware
+REQUIRE_IMAGE_METADATA=1
+
+platform_check_image() {
+ return 0
+}
+
+platform_do_upgrade() {
+ local board=$(board_name)
+
+ case "$board" in
+ *)
+ default_do_upgrade "$1"
+ ;;
+ esac
+}