mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2025-01-02 04:12:29 +00:00
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>
This commit is contained in:
parent
c36ef5970b
commit
0130022bae
@ -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"
|
||||
;;
|
@ -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)
|
@ -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
|
||||
;;
|
18
target/linux/ath79/nand/base-files/etc/board.d/01_leds
Executable file
18
target/linux/ath79/nand/base-files/etc/board.d/01_leds
Executable file
@ -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
|
35
target/linux/ath79/nand/base-files/etc/board.d/02_network
Executable file
35
target/linux/ath79/nand/base-files/etc/board.d/02_network
Executable file
@ -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
|
20
target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
Normal file
20
target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
Normal file
@ -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
|
||||
}
|
85
target/linux/ath79/tiny/base-files/etc/board.d/01_leds
Executable file
85
target/linux/ath79/tiny/base-files/etc/board.d/01_leds
Executable file
@ -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
|
96
target/linux/ath79/tiny/base-files/etc/board.d/02_network
Executable file
96
target/linux/ath79/tiny/base-files/etc/board.d/02_network
Executable file
@ -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
|
@ -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
|
20
target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh
Normal file
20
target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user