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:
committed by
John Crispin
parent
c36ef5970b
commit
0130022bae
248
target/linux/ath79/generic/base-files/etc/board.d/01_leds
Executable file
248
target/linux/ath79/generic/base-files/etc/board.d/01_leds
Executable file
@@ -0,0 +1,248 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
boardname="${board##*,}"
|
||||
|
||||
case "$board" in
|
||||
8dev,carambola2)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:orange:eth0" "eth0"
|
||||
ucidef_set_led_switch "wan" "WAN" "$boardname:orange:eth1" "switch0" "0x04"
|
||||
;;
|
||||
alfa-network,ap121f)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
|
||||
;;
|
||||
avm,fritz300e)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:green:rssi0" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:green:rssi1" "wlan0" "20" "100"
|
||||
ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$boardname:green:rssi2" "wlan0" "40" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssi3" "wlan0" "60" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssi4" "wlan0" "80" "100"
|
||||
;;
|
||||
avm,fritz4020)
|
||||
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
|
||||
ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x1E"
|
||||
;;
|
||||
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"
|
||||
ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:red:rssimediumlow" "wlan0" "26" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100"
|
||||
;;
|
||||
comfast,cf-e120a-v3)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1"
|
||||
ucidef_set_led_switch "wan" "WAN" "$boardname:green:wan" "switch0" "0x04"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:red:rssimediumlow" "wlan0" "26" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100"
|
||||
;;
|
||||
comfast,cf-e313ac)
|
||||
ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x02"
|
||||
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:red:rssimediumlow" "wlan0" "26" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100"
|
||||
;;
|
||||
comfast,cf-e314n-v2)
|
||||
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth1"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:red:rssilow" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:red:rssimediumlow" "wlan0" "26" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "$boardname:green:rssimediumhigh" "wlan0" "51" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:green:rssihigh" "wlan0" "76" "100"
|
||||
;;
|
||||
comfast,cf-e5)
|
||||
ucidef_set_led_switch "lan" "LAN" "$boardname:blue:lan" "switch0" "0x02"
|
||||
ucidef_set_led_netdev "wan" "WAN" "$boardname:blue:wan" "eth1"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:blue:rssi0" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$boardname:blue:rssi1" "wlan0" "33" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$boardname:blue:rssi2" "wlan0" "66" "100"
|
||||
;;
|
||||
dlink,dir-842-c1|\
|
||||
dlink,dir-842-c2|\
|
||||
dlink,dir-842-c3|\
|
||||
dlink,dir-859-a1)
|
||||
ucidef_set_led_switch "internet" "WAN" "$boardname:green:internet" "switch0" "0x20"
|
||||
;;
|
||||
engenius,ecb1750)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:blue:lan" "eth0"
|
||||
;;
|
||||
engenius,ews511ap)
|
||||
ucidef_set_led_netdev "lan1" "LAN1" "$boardname:blue:lan1" "eth1"
|
||||
ucidef_set_led_netdev "lan2" "LAN2" "$boardname:blue:lan2" "eth0"
|
||||
;;
|
||||
etactica,eg200)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:red:eth0" "eth0"
|
||||
ucidef_set_led_oneshot "modbus" "Modbus" "$boardname:red:modbus" "100" "33"
|
||||
;;
|
||||
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-nor)
|
||||
ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth0"
|
||||
;;
|
||||
glinet,gl-ar300m-lite)
|
||||
ucidef_set_led_netdev "lan" "LAN" "gl-ar300m-lite:green:lan" "eth0"
|
||||
;;
|
||||
glinet,gl-x750)
|
||||
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
|
||||
;;
|
||||
pcs,cap324)
|
||||
ucidef_set_led_netdev "lan" "LAN" "pcs:lan:green" "eth0"
|
||||
;;
|
||||
pcs,cr3000)
|
||||
ucidef_set_led_netdev "wan" "WAN" "pcs:blue:wan" "eth1"
|
||||
ucidef_set_led_switch "lan1" "LAN1" "pcs:blue:lan1" "switch0" "0x04"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "pcs:blue:lan2" "switch0" "0x08"
|
||||
ucidef_set_led_switch "lan3" "LAN3" "pcs:blue:lan3" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan4" "LAN4" "pcs:blue:lan4" "switch0" "0x02"
|
||||
;;
|
||||
qihoo,c301)
|
||||
ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt"
|
||||
;;
|
||||
tplink,archer-a7-v5|\
|
||||
tplink,archer-c7-v4|\
|
||||
tplink,archer-c7-v5)
|
||||
ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x02"
|
||||
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" "0x20"
|
||||
;;
|
||||
tplink,archer-c2-v3|\
|
||||
tplink,tl-wr1043nd-v4|\
|
||||
tplink,tl-wr1043n-v5)
|
||||
ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x20"
|
||||
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,archer-c6-v2)
|
||||
ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x3C"
|
||||
ucidef_set_led_switch "wan" "WAN" "tp-link:green:wan" "switch0" "0x02"
|
||||
;;
|
||||
tplink,archer-c25-v1|\
|
||||
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"
|
||||
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,archer-c58-v1|\
|
||||
tplink,archer-c59-v1|\
|
||||
tplink,archer-c59-v2|\
|
||||
tplink,archer-c60-v1|\
|
||||
tplink,archer-c60-v2)
|
||||
ucidef_set_led_switch "lan" "LAN" "tp-link:green:lan" "switch0" "0x1E"
|
||||
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
|
||||
;;
|
||||
tplink,archer-d50-v1)
|
||||
ucidef_set_led_switch "lan" "LAN" "tp-link:white:lan" "switch0" "0x1c"
|
||||
ucidef_set_led_switch "wan_data" "WAN Data" "tp-link:white:internet" "switch0" "0x02" "" "tx rx"
|
||||
ucidef_set_led_switch "wan_link" "WAN Link" "tp-link:white:wan" "switch0" "0x02" "" "link"
|
||||
;;
|
||||
tplink,cpe210-v1|\
|
||||
tplink,cpe220-v2|\
|
||||
tplink,cpe510-v1)
|
||||
ucidef_set_led_netdev "lan0" "LAN0" "tp-link:green:lan0" "eth1"
|
||||
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" "0x10"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "tp-link:green:link1" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "tp-link:green:link2" "wlan0" "30" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "60" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "80" "100"
|
||||
;;
|
||||
tplink,cpe210-v2|\
|
||||
tplink,cpe210-v3)
|
||||
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "tp-link:green:link1" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "tp-link:green:link2" "wlan0" "30" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "60" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "80" "100"
|
||||
;;
|
||||
tplink,cpe510-v2|\
|
||||
tplink,cpe510-v3)
|
||||
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "tp-link:green:link1" "wlan0" "1" "100" "0" "13"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "tp-link:green:link2" "wlan0" "26" "100" "-25" "13"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "tp-link:green:link3" "wlan0" "51" "100" "-50" "13"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:green:link4" "wlan0" "76" "100" "-75" "13"
|
||||
;;
|
||||
tplink,cpe610-v1)
|
||||
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
|
||||
;;
|
||||
tplink,re355-v1|\
|
||||
tplink,re450-v1|\
|
||||
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-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"
|
||||
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"
|
||||
;;
|
||||
trendnet,tew-823dru)
|
||||
ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
|
||||
;;
|
||||
ubnt,bullet-m|\
|
||||
ubnt,bullet-m-xw|\
|
||||
ubnt,nanostation-m|\
|
||||
ubnt,nanostation-m-xw|\
|
||||
ubnt,rocket-m)
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:red:link1" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "ubnt:orange:link2" "wlan0" "26" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "ubnt:green:link3" "wlan0" "51" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "ubnt:green:link4" "wlan0" "76" "100"
|
||||
;;
|
||||
ubnt,nanobeam-ac|\
|
||||
ubnt,nanostation-ac)
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:blue:rssi0" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "ubnt:blue:rssi1" "wlan0" "26" "100"
|
||||
ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "ubnt:blue:rssi2" "wlan0" "51" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "ubnt:blue:rssi3" "wlan0" "76" "100"
|
||||
;;
|
||||
wd,mynet-wifi-rangeextender)
|
||||
ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
|
||||
ucidef_set_rssimon "wlan0" "200000" "1"
|
||||
ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:rssi-low" "wlan0" "1" "100"
|
||||
ucidef_set_led_rssi "rssimedium" "RSSIMED" "$boardname:blue:rssi-med" "wlan0" "33" "100"
|
||||
ucidef_set_led_rssi "rssihigh" "RSSIMAX" "$boardname:blue:rssi-max" "wlan0" "66" "100"
|
||||
;;
|
||||
yuncore,a770)
|
||||
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth1"
|
||||
ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" "0x10"
|
||||
;;
|
||||
zbtlink,zbt-wd323)
|
||||
ucidef_set_led_switch "lan1" "LAN1" "zbt-wd323:orange:lan1" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "zbt-wd323:orange:lan2" "switch0" "0x08"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
419
target/linux/ath79/generic/base-files/etc/board.d/02_network
Executable file
419
target/linux/ath79/generic/base-files/etc/board.d/02_network
Executable file
@@ -0,0 +1,419 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/k2t.sh
|
||||
|
||||
ath79_setup_interfaces()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case "$board" in
|
||||
adtran,bsap1800-v2|\
|
||||
adtran,bsap1840|\
|
||||
alfa-network,ap121f|\
|
||||
aruba,ap-105|\
|
||||
avm,fritz300e|\
|
||||
devolo,dvl1200i|\
|
||||
devolo,dvl1750c|\
|
||||
devolo,dvl1750i|\
|
||||
devolo,dvl1750x|\
|
||||
engenius,ecb1750|\
|
||||
glinet,gl-ar300m-lite|\
|
||||
netgear,ex6400|\
|
||||
netgear,ex7300|\
|
||||
ocedo,koala|\
|
||||
ocedo,raccoon|\
|
||||
pcs,cap324|\
|
||||
pisen,ts-d084|\
|
||||
pisen,wmb001n|\
|
||||
pisen,wmm003n|\
|
||||
tplink,cpe210-v2|\
|
||||
tplink,cpe210-v3|\
|
||||
tplink,cpe510-v2|\
|
||||
tplink,cpe510-v3|\
|
||||
tplink,cpe610-v1|\
|
||||
tplink,re350k-v1|\
|
||||
tplink,re355-v1|\
|
||||
tplink,re450-v1|\
|
||||
tplink,re450-v2|\
|
||||
ubnt,bullet-m|\
|
||||
ubnt,bullet-m-xw|\
|
||||
ubnt,lap-120|\
|
||||
ubnt,nanobeam-ac|\
|
||||
ubnt,nanostation-ac-loco|\
|
||||
ubnt,rocket-m|\
|
||||
ubnt,unifiac-lite|\
|
||||
ubnt,unifiac-lr|\
|
||||
ubnt,unifiac-mesh|\
|
||||
ubnt,unifi|\
|
||||
wd,mynet-wifi-rangeextender|\
|
||||
winchannel,wb2000)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
;;
|
||||
avm,fritz4020|\
|
||||
pcs,cr3000|\
|
||||
tplink,archer-c58-v1|\
|
||||
tplink,archer-c59-v1|\
|
||||
tplink,archer-c59-v2)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
|
||||
;;
|
||||
buffalo,bhr-4grv|\
|
||||
buffalo,wzr-hp-g450h)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
|
||||
;;
|
||||
buffalo,bhr-4grv2|\
|
||||
trendnet,tew-823dru)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth0"
|
||||
;;
|
||||
buffalo,wzr-hp-ag300h|\
|
||||
tplink,archer-c25-v1|\
|
||||
tplink,tl-wdr3500-v1|\
|
||||
tplink,tl-wr842n-v1|\
|
||||
tplink,tl-wr842n-v3|\
|
||||
ubnt,airrouter)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
|
||||
;;
|
||||
buffalo,wzr-hp-g302h-a1a0)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"
|
||||
;;
|
||||
comfast,cf-e110n-v2|\
|
||||
comfast,cf-e120a-v3|\
|
||||
comfast,cf-e314n-v2|\
|
||||
tplink,cpe210-v1|\
|
||||
tplink,cpe220-v2|\
|
||||
tplink,cpe510-v1|\
|
||||
ubnt,nanostation-m|\
|
||||
ubnt,routerstation)
|
||||
ucidef_set_interfaces_lan_wan "eth1" "eth0"
|
||||
;;
|
||||
comfast,cf-wr650ac-v1|\
|
||||
comfast,cf-wr650ac-v2)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
|
||||
;;
|
||||
devolo,dvl1200e|\
|
||||
devolo,dvl1750e|\
|
||||
ocedo,ursus)
|
||||
ucidef_set_interface_lan "eth0 eth1"
|
||||
;;
|
||||
dlink,dir-825-b1)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan" "1:lan" "2:lan" "3:lan" "5@eth0"
|
||||
;;
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1|\
|
||||
dlink,dir-842-c1|\
|
||||
dlink,dir-842-c2|\
|
||||
dlink,dir-842-c3|\
|
||||
dlink,dir-859-a1|\
|
||||
engenius,epg5000|\
|
||||
tplink,archer-c2-v3|\
|
||||
tplink,tl-wr1043nd-v4|\
|
||||
tplink,tl-wr1043n-v5)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
|
||||
;;
|
||||
elecom,wrc-1750ghbk2-i|\
|
||||
elecom,wrc-300ghbk2-i)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan:4" "3:lan:3" "4:lan:2" "5:lan:1" "1:wan"
|
||||
;;
|
||||
embeddedwireless,dorin)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:wan" "2:lan:3" "3:lan:2"
|
||||
;;
|
||||
engenius,ews511ap)
|
||||
ucidef_set_interface_lan "eth0 eth1" "dhcp"
|
||||
;;
|
||||
etactica,eg200)
|
||||
ucidef_set_interface_lan "eth0" "dhcp"
|
||||
;;
|
||||
glinet,gl-ar750)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan" "2:lan"
|
||||
;;
|
||||
glinet,gl-ar750s)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan:2" "3:lan:1" "1:wan"
|
||||
;;
|
||||
iodata,etg3-r|\
|
||||
iodata,wn-ac1167dgr|\
|
||||
iodata,wn-ac1600dgr|\
|
||||
iodata,wn-ac1600dgr2|\
|
||||
iodata,wn-ag300dgr|\
|
||||
pcs,cr5000|\
|
||||
sitecom,wlr-7100|\
|
||||
wd,mynet-n750)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
|
||||
;;
|
||||
librerouter,librerouter-v1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "5:wan" "6@eth1" "4:lan"
|
||||
;;
|
||||
nec,wg1200cr|\
|
||||
ubnt,nanostation-ac|\
|
||||
ubnt,unifiac-mesh-pro|\
|
||||
ubnt,unifiac-pro)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan" "3:wan"
|
||||
;;
|
||||
nec,wg800hp)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan" "3:lan" "4:lan" "1:wan"
|
||||
;;
|
||||
netgear,wndr3700|\
|
||||
netgear,wndr3700v2|\
|
||||
netgear,wndr3800|\
|
||||
netgear,wndr3800ch)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
|
||||
ucidef_add_switch_attr "switch0" "blinkrate" 2
|
||||
ucidef_add_switch_port_attr "switch0" 1 led 6
|
||||
ucidef_add_switch_port_attr "switch0" 2 led 9
|
||||
ucidef_add_switch_port_attr "switch0" 5 led 2
|
||||
;;
|
||||
phicomm,k2t)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "3:lan:1" "5:lan:2" "4:wan"
|
||||
;;
|
||||
qihoo,c301)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan" "3:lan"
|
||||
;;
|
||||
rosinson,wr818)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan" "2:lan" "3:wan"
|
||||
;;
|
||||
tplink,archer-a7-v5|\
|
||||
tplink,archer-c6-v2|\
|
||||
tplink,archer-c7-v4|\
|
||||
tplink,archer-c7-v5|\
|
||||
tplink,tl-wdr3600-v1|\
|
||||
tplink,tl-wdr4300-v1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
|
||||
;;
|
||||
tplink,archer-c5-v1|\
|
||||
tplink,archer-c7-v1|\
|
||||
tplink,archer-c7-v2|\
|
||||
tplink,tl-wdr4900-v2)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth0" "1:wan"
|
||||
;;
|
||||
tplink,archer-c60-v1|\
|
||||
tplink,archer-c60-v2)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
|
||||
;;
|
||||
tplink,archer-d50-v1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "1:wan"
|
||||
;;
|
||||
tplink,tl-wr842n-v2)
|
||||
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-wr1043nd-v1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
|
||||
;;
|
||||
tplink,tl-wr1043nd-v2|\
|
||||
tplink,tl-wr1043nd-v3)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" "6@eth0"
|
||||
;;
|
||||
tplink,tl-wr2543-v1)
|
||||
ucidef_add_switch "switch0" \
|
||||
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0"
|
||||
;;
|
||||
ubnt,acb-isp)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "2:lan:1" "3:lan:3" "4:lan:2"
|
||||
;;
|
||||
ubnt,routerstation-pro)
|
||||
ucidef_set_interface_wan "eth0"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
|
||||
;;
|
||||
ubnt,nanostation-m-xw)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "5:lan" "1:wan"
|
||||
;;
|
||||
zbtlink,zbt-wd323|\
|
||||
xiaomi,mi-router-4q)
|
||||
ucidef_set_interface_wan "eth1"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "3:lan:1" "4:lan:2"
|
||||
;;
|
||||
zyxel,nbg6716)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
|
||||
;;
|
||||
*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ath79_setup_macs()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case "$board" in
|
||||
adtran,bsap1800-v2|\
|
||||
adtran,bsap1840)
|
||||
lan_mac=$(mtd_get_mac_binary "Board data" 2)
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
alfa-network,ap121f|\
|
||||
ubnt,airrouter|\
|
||||
ubnt,bullet-m|\
|
||||
ubnt,nanostation-m|\
|
||||
ubnt,rocket-m|\
|
||||
ubnt,unifi)
|
||||
label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
|
||||
;;
|
||||
avm,fritz300e)
|
||||
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
|
||||
label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
|
||||
;;
|
||||
avm,fritz4020)
|
||||
lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
|
||||
wan_mac=$(fritz_tffs -n macb -i $(find_mtd_part "tffs (1)"))
|
||||
;;
|
||||
dlink,dir-825-b1)
|
||||
lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
|
||||
wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)
|
||||
;;
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1)
|
||||
lan_mac=$(mtd_get_mac_text "mac" 0x4)
|
||||
wan_mac=$(mtd_get_mac_text "mac" 0x18)
|
||||
;;
|
||||
dlink,dir-842-c1|\
|
||||
dlink,dir-842-c2|\
|
||||
dlink,dir-842-c3|\
|
||||
nec,wg1200cr)
|
||||
lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
|
||||
wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
dlink,dir-859-a1|\
|
||||
qihoo,c301|\
|
||||
wd,mynet-n750)
|
||||
lan_mac=$(mtd_get_mac_ascii devdata "lanmac")
|
||||
wan_mac=$(mtd_get_mac_ascii devdata "wanmac")
|
||||
;;
|
||||
elecom,wrc-1750ghbk2-i|\
|
||||
elecom,wrc-300ghbk2-i)
|
||||
wan_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" -2)
|
||||
;;
|
||||
engenius,ecb1750)
|
||||
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
label_mac=$(mtd_get_mac_ascii u-boot-env athaddr)
|
||||
;;
|
||||
engenius,epg5000)
|
||||
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
||||
;;
|
||||
engenius,ews511ap)
|
||||
lan_mac=$(mtd_get_mac_text "u-boot-env" 0xe9)
|
||||
eth1_mac=$(macaddr_add "$lan_mac" 1)
|
||||
ucidef_set_interface "eth0" ifname "eth0" protocol "none" macaddr "$lan_mac"
|
||||
ucidef_set_interface "eth1" ifname "eth1" protocol "none" macaddr "$eth1_mac"
|
||||
;;
|
||||
iodata,etg3-r)
|
||||
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
wan_mac=$(macaddr_add "$lan_mac" -1)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
iodata,wn-ac1167dgr|\
|
||||
iodata,wn-ac1600dgr|\
|
||||
iodata,wn-ac1600dgr2|\
|
||||
iodata,wn-ag300dgr)
|
||||
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
jjplus,ja76pf2)
|
||||
wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n alias/ethaddr)
|
||||
lan_mac=$(macaddr_add "$wan_mac" 1)
|
||||
;;
|
||||
nec,wg800hp)
|
||||
lan_mac=$(mtd_get_mac_text board_data 0x280)
|
||||
wan_mac=$(mtd_get_mac_text board_data 0x480)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
netgear,wndr3700|\
|
||||
netgear,wndr3700v2|\
|
||||
netgear,wndr3800)
|
||||
lan_mac=$(macaddr_setbit_la "$(mtd_get_mac_binary art 0x0)")
|
||||
;;
|
||||
phicomm,k2t)
|
||||
lan_mac=$(k2t_get_mac "lan_mac")
|
||||
wan_mac=$(k2t_get_mac "wan_mac")
|
||||
;;
|
||||
rosinson,wr818)
|
||||
wan_mac=$(mtd_get_mac_binary factory 0x0)
|
||||
lan_mac=$(macaddr_setbit_la "$wan_mac")
|
||||
;;
|
||||
sitecom,wlr-7100)
|
||||
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
|
||||
label_mac=$lan_mac
|
||||
;;
|
||||
tplink,archer-a7-v5|\
|
||||
tplink,archer-c7-v4|\
|
||||
tplink,archer-c7-v5|\
|
||||
tplink,tl-wr1043nd-v4|\
|
||||
tplink,tl-wr1043n-v5)
|
||||
base_mac=$(mtd_get_mac_binary info 0x8)
|
||||
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)
|
||||
label_mac=$wan_mac
|
||||
;;
|
||||
ubnt,routerstation|\
|
||||
ubnt,routerstation-pro)
|
||||
wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n ar7100_esa)
|
||||
lan_mac=$(macaddr_add "$wan_mac" 1)
|
||||
;;
|
||||
wd,mynet-wifi-rangeextender)
|
||||
lan_mac=$(nvram get et0macaddr)
|
||||
;;
|
||||
zyxel,nbg6716)
|
||||
lan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2)
|
||||
wan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3)
|
||||
;;
|
||||
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
|
||||
66
target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches
Executable file
66
target/linux/ath79/generic/base-files/etc/board.d/03_gpio_switches
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2018 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
adtran,bsap1800-v2|\
|
||||
adtran,bsap1840)
|
||||
ucidef_add_gpio_switch "wifi1_ext_a" "5GHz External Antenna A" "489" "1"
|
||||
ucidef_add_gpio_switch "wifi1_int_a" "5GHz Internal Antenna A" "493"
|
||||
ucidef_add_gpio_switch "wifi1_ext_b" "5GHz External Antenna B" "494" "1"
|
||||
ucidef_add_gpio_switch "wifi1_int_b" "5GHz Internal Antenna B" "495"
|
||||
ucidef_add_gpio_switch "wifi1_ext_c" "5GHz External Antenna C" "496" "1"
|
||||
ucidef_add_gpio_switch "wifi1_int_c" "5GHz Internal Antenna C" "497"
|
||||
ucidef_add_gpio_switch "wifi0_ext_a" "2.4GHz External Antenna A" "505" "1"
|
||||
ucidef_add_gpio_switch "wifi0_int_a" "2.4GHz Internal Antenna A" "506"
|
||||
ucidef_add_gpio_switch "wifi0_ext_b" "2.4GHz External Antenna B" "507" "1"
|
||||
ucidef_add_gpio_switch "wifi0_int_b" "2.4GHz Internal Antenna B" "508"
|
||||
ucidef_add_gpio_switch "wifi0_ext_c" "2.4GHz External Antenna C" "509" "1"
|
||||
ucidef_add_gpio_switch "wifi0_int_c" "2.4GHz Internal Antenna C" "510"
|
||||
;;
|
||||
comfast,cf-e5)
|
||||
ucidef_add_gpio_switch "lte_power" "LTE Power" "14" "1"
|
||||
ucidef_add_gpio_switch "lte_wakeup" "LTE Wakeup" "11" "1"
|
||||
ucidef_add_gpio_switch "lte_poweroff" "LTE Poweroff" "1" "1"
|
||||
ucidef_add_gpio_switch "lte_reset" "LTE Reset" "12" "1"
|
||||
;;
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1)
|
||||
ucidef_add_gpio_switch "wan_led_auto" "WAN LED Auto" "20" "0"
|
||||
;;
|
||||
librerouter,librerouter-v1)
|
||||
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "1" "0"
|
||||
;;
|
||||
tplink,archer-c25-v1)
|
||||
ucidef_add_gpio_switch "led_control" "LED control" "21" "0"
|
||||
ucidef_add_gpio_switch "led_reset" "LED reset" "19" "1"
|
||||
;;
|
||||
tplink,cpe210-v1|\
|
||||
tplink,cpe220-v2|\
|
||||
tplink,cpe510-v1)
|
||||
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
|
||||
;;
|
||||
ubnt,nanostation-ac)
|
||||
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "3"
|
||||
;;
|
||||
ubnt,acb-isp)
|
||||
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "11"
|
||||
;;
|
||||
zbtlink,zbt-wd323)
|
||||
ucidef_add_gpio_switch "io0" "IO#0" "0"
|
||||
ucidef_add_gpio_switch "io1" "IO#1" "1"
|
||||
ucidef_add_gpio_switch "io2" "IO#2" "2"
|
||||
ucidef_add_gpio_switch "io14" "IO#14" "14"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,144 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||
|
||||
. /lib/functions/caldata.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$FIRMWARE" in
|
||||
"ath9k-eeprom-ahb-18100000.wmac.bin")
|
||||
case $board in
|
||||
avm,fritz4020)
|
||||
caldata_extract_reverse "urlader" 0x1541 0x440
|
||||
;;
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_text "mac" 0x4)
|
||||
;;
|
||||
dlink,dir-842-c1|\
|
||||
dlink,dir-842-c2|\
|
||||
dlink,dir-842-c3|\
|
||||
dlink,dir-859-a1|\
|
||||
nec,wg1200cr|\
|
||||
wd,mynet-n750)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac")
|
||||
;;
|
||||
engenius,ecb1750)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env "athaddr") +1)
|
||||
;;
|
||||
engenius,epg5000|\
|
||||
iodata,wn-ac1167dgr|\
|
||||
iodata,wn-ac1600dgr|\
|
||||
iodata,wn-ac1600dgr2|\
|
||||
iodata,wn-ag300dgr|\
|
||||
sitecom,wlr-7100)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
;;
|
||||
nec,wg800hp)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_text board_data 0x680)
|
||||
;;
|
||||
qihoo,c301)
|
||||
caldata_extract "radiocfg" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan24mac")
|
||||
;;
|
||||
zyxel,nbg6716)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_ascii u-boot-env ethaddr)
|
||||
;;
|
||||
*)
|
||||
caldata_die "board $board is not supported yet"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath9k-eeprom-pci-0000:00:00.0.bin")
|
||||
case $board in
|
||||
avm,fritz300e)
|
||||
caldata_extract_reverse "urloader" 0x1541 0x440
|
||||
;;
|
||||
buffalo,wzr-hp-g302h-a1a0)
|
||||
caldata_extract "art" 0x1000 0xeb8
|
||||
;;
|
||||
buffalo,wzr-hp-g450h)
|
||||
caldata_extract "art" 0x1000 0x440
|
||||
;;
|
||||
dlink,dir-825-c1|\
|
||||
dlink,dir-835-a1)
|
||||
caldata_extract "art" 0x5000 0x440
|
||||
ath9k_patch_mac $(macaddr_add $(mtd_get_mac_text "mac" 0x18) 1)
|
||||
;;
|
||||
ocedo,raccoon|\
|
||||
tplink,tl-wdr3500-v1|\
|
||||
tplink,tl-wdr3600-v1|\
|
||||
tplink,tl-wdr4300-v1|\
|
||||
tplink,tl-wdr4900-v2|\
|
||||
winchannel,wb2000)
|
||||
caldata_extract "art" 0x5000 0x440
|
||||
;;
|
||||
pcs,cap324|\
|
||||
tplink,tl-wr2543-v1|\
|
||||
tplink,tl-wr842n-v1|\
|
||||
ubnt,airrouter|\
|
||||
ubnt,bullet-m|\
|
||||
ubnt,nano-m|\
|
||||
ubnt,rocket-m)
|
||||
caldata_extract "art" 0x1000 0x1000
|
||||
;;
|
||||
ubnt,unifi)
|
||||
caldata_extract "art" 0x1000 0x800
|
||||
;;
|
||||
wd,mynet-n750)
|
||||
caldata_extract "art" 0x5000 0x440
|
||||
ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")
|
||||
;;
|
||||
wd,mynet-wifi-rangeextender)
|
||||
caldata_extract "art" 0x1000 0x1000
|
||||
ath9k_patch_mac $(nvram get wl0_hwaddr)
|
||||
;;
|
||||
*)
|
||||
caldata_die "board $board is not supported yet"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath9k-eeprom-pci-0000:00:11.0.bin")
|
||||
case $board in
|
||||
buffalo,wzr-hp-ag300h|\
|
||||
netgear,wndr3700|\
|
||||
netgear,wndr3700v2|\
|
||||
netgear,wndr3800|\
|
||||
netgear,wndr3800ch)
|
||||
caldata_extract "art" 0x1000 0xeb8
|
||||
;;
|
||||
dlink,dir-825-b1)
|
||||
caldata_extract "caldata" 0x1000 0xeb8
|
||||
ath9k_patch_mac_crc $(mtd_get_mac_text "caldata" 0xffa0) 0x20c
|
||||
;;
|
||||
*)
|
||||
caldata_die "board $board is not supported yet"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath9k-eeprom-pci-0000:00:12.0.bin")
|
||||
case $board in
|
||||
buffalo,wzr-hp-ag300h|\
|
||||
netgear,wndr3700|\
|
||||
netgear,wndr3700v2|\
|
||||
netgear,wndr3800|\
|
||||
netgear,wndr3800ch)
|
||||
caldata_extract "art" 0x5000 0xeb8
|
||||
;;
|
||||
dlink,dir-825-b1)
|
||||
caldata_extract "caldata" 0x5000 0xeb8
|
||||
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 0xffb4) 1) 0x20c
|
||||
;;
|
||||
*)
|
||||
caldata_die "board $board is not supported yet"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,167 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||
|
||||
. /lib/functions/caldata.sh
|
||||
. /lib/functions/k2t.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$FIRMWARE" in
|
||||
"ath10k/cal-pci-0000:00:00.0.bin")
|
||||
case $board in
|
||||
comfast,cf-wr650ac-v1|\
|
||||
comfast,cf-wr650ac-v2|\
|
||||
yuncore,a770)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
;;
|
||||
devolo,dvl1200e|\
|
||||
devolo,dvl1200i|\
|
||||
devolo,dvl1750c|\
|
||||
devolo,dvl1750e|\
|
||||
devolo,dvl1750i|\
|
||||
devolo,dvl1750x)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) -1)
|
||||
;;
|
||||
dlink,dir-859-a1)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")
|
||||
;;
|
||||
elecom,wrc-1750ghbk2-i)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
;;
|
||||
engenius,ecb1750)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr)
|
||||
;;
|
||||
engenius,epg5000|\
|
||||
iodata,wn-ac1167dgr|\
|
||||
iodata,wn-ac1600dgr2|\
|
||||
sitecom,wlr-7100)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
|
||||
;;
|
||||
engenius,ews511ap)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
||||
;;
|
||||
glinet,gl-ar750|\
|
||||
glinet,gl-ar750s)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1)
|
||||
;;
|
||||
glinet,gl-x750)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2)
|
||||
;;
|
||||
nec,wg800hp)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(mtd_get_mac_text board_data 0x880)
|
||||
;;
|
||||
ocedo,koala|\
|
||||
ocedo,ursus)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(mtd_get_mac_binary art 0xc)
|
||||
;;
|
||||
openmesh,om5p-ac-v2)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16)
|
||||
;;
|
||||
qihoo,c301)
|
||||
caldata_extract "radiocfg" 0x5000 0x844
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
|
||||
;;
|
||||
tplink,archer-a7-v5|\
|
||||
tplink,archer-c2-v3|\
|
||||
tplink,archer-c7-v4|\
|
||||
tplink,archer-c7-v5|\
|
||||
tplink,archer-c25-v1)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1)
|
||||
;;
|
||||
tplink,archer-c5-v1|\
|
||||
tplink,archer-c7-v2)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x1fc00) -1)
|
||||
;;
|
||||
tplink,archer-d50-v1)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary romfile 0xf100) +2)
|
||||
;;
|
||||
tplink,re350k-v1)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x10008) +2)
|
||||
;;
|
||||
tplink,re355-v1|\
|
||||
tplink,re450-v1)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2)
|
||||
;;
|
||||
tplink,re450-v2)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +1)
|
||||
;;
|
||||
ubnt,unifiac-lite|\
|
||||
ubnt,unifiac-lr|\
|
||||
ubnt,unifiac-mesh|\
|
||||
ubnt,unifiac-mesh-pro|\
|
||||
ubnt,lap-120|\
|
||||
ubnt,nanobeam-ac|\
|
||||
ubnt,nanostation-ac|\
|
||||
ubnt,nanostation-ac-loco|\
|
||||
ubnt,unifiac-pro)
|
||||
caldata_extract "EEPROM" 0x5000 0x844
|
||||
;;
|
||||
zyxel,nbg6716)
|
||||
caldata_extract "art" 0x5000 0x844
|
||||
ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"ath10k/pre-cal-pci-0000:00:00.0.bin")
|
||||
case $board in
|
||||
comfast,cf-e313ac)
|
||||
caldata_extract "art" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary art 0x6)
|
||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
rm /lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin
|
||||
;;
|
||||
dlink,dir-842-c1|\
|
||||
dlink,dir-842-c2|\
|
||||
dlink,dir-842-c3|\
|
||||
nec,wg1200cr)
|
||||
caldata_extract "art" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
|
||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
;;
|
||||
netgear,ex6400|\
|
||||
netgear,ex7300)
|
||||
caldata_extract "caldata" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc)
|
||||
;;
|
||||
phicomm,k2t)
|
||||
caldata_extract "art" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(k2t_get_mac "5g_mac")
|
||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
;;
|
||||
tplink,archer-c58-v1|\
|
||||
tplink,archer-c59-v1|\
|
||||
tplink,archer-c59-v2|\
|
||||
tplink,archer-c60-v1|\
|
||||
tplink,archer-c60-v2|\
|
||||
tplink,archer-c6-v2)
|
||||
caldata_extract "art" 0x5000 0x2f20
|
||||
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1)
|
||||
ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \
|
||||
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,45 @@
|
||||
#!/bin/ash
|
||||
|
||||
[ "$ACTION" = "add" ] || exit 0
|
||||
|
||||
PHYNBR=${DEVPATH##*/phy}
|
||||
|
||||
[ -n $PHYNBR ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/k2t.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
adtran,bsap1800-v2|\
|
||||
adtran,bsap1840)
|
||||
macaddr_add "$(mtd_get_mac_binary 'Board data' 2)" $(($PHYNBR * 8 + 1)) > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
iodata,wn-ac1600dgr)
|
||||
# There is no eeprom data for 5 GHz wlan in "art" partition
|
||||
# which would allow to patch the macaddress
|
||||
[ "$PHYNBR" -eq 0 ] && \
|
||||
macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
iodata,wn-ag300dgr)
|
||||
# There is no eeprom data for 5 GHz wlan in "art" partition
|
||||
# which would allow to patch the macaddress
|
||||
[ "$PHYNBR" -eq 1 ] && \
|
||||
macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
phicomm,k2t)
|
||||
# The K2T factory firmware does use LAN mac address as the 2.4G wifi mac address
|
||||
[ "$PHYNBR" -eq 1 ] && \
|
||||
k2t_get_mac "lan_mac" > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
trendnet,tew-823dru)
|
||||
# set the 2.4G interface mac address to LAN MAC
|
||||
[ "$PHYNBR" -eq 1 ] && \
|
||||
mtd_get_mac_text mac 4 > /sys${DEVPATH}/macaddress
|
||||
# set the 5G interface mac address to WAN MAC + 1
|
||||
[ "$PHYNBR" -eq 0 ] && \
|
||||
macaddr_add "$(mtd_get_mac_text mac 0x18)" 1 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
esac
|
||||
16
target/linux/ath79/generic/base-files/etc/init.d/bootcount
Executable file
16
target/linux/ath79/generic/base-files/etc/init.d/bootcount
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
boot() {
|
||||
case $(board_name) in
|
||||
adtran,bsap1800-v2|\
|
||||
adtran,bsap1840)
|
||||
fconfig -s -w -d $(find_mtd_part "RedBoot config") -n boot_cntb -x 0
|
||||
;;
|
||||
qihoo,c301)
|
||||
local n=$(fw_printenv activeregion | cut -d = -f 2)
|
||||
fw_setenv "image${n}trynum" 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/migrations.sh
|
||||
|
||||
board=$(board_name)
|
||||
boardonly="${board##*,}"
|
||||
|
||||
case "$board" in
|
||||
engenius,epg5000)
|
||||
migrate_leds ":wlan-2g=:wlan2g" ":wlan-5g=:wlan5g"
|
||||
;;
|
||||
tplink,archer-c25-v1|\
|
||||
tplink,archer-c58-v1|\
|
||||
tplink,archer-c59-v1|\
|
||||
tplink,archer-c59-v2|\
|
||||
tplink,archer-c60-v1|\
|
||||
tplink,archer-c60-v2|\
|
||||
tplink,archer-c7-v4|\
|
||||
tplink,archer-c7-v5)
|
||||
migrate_leds "^$boardonly:=tp-link:"
|
||||
;;
|
||||
tplink,archer-c7-v2)
|
||||
migrate_leds ":blue:=:green:"
|
||||
;;
|
||||
tplink,re355-v1)
|
||||
migrate_leds "re355:=tp-link:"
|
||||
;;
|
||||
tplink,re450-v1)
|
||||
migrate_leds "re450:=tp-link:"
|
||||
;;
|
||||
wd,mynet-n750)
|
||||
migrate_leds "wd:=mynet-n750:"
|
||||
;;
|
||||
esac
|
||||
|
||||
migrations_apply system
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
|
||||
fix_seama_header() {
|
||||
local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd)
|
||||
[ "$kernel_size" ] && mtd -c 0x$kernel_size fixseama firmware
|
||||
}
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
qihoo,c301)
|
||||
fix_seama_header
|
||||
;;
|
||||
esac
|
||||
55
target/linux/ath79/generic/base-files/lib/functions/k2t.sh
Executable file
55
target/linux/ath79/generic/base-files/lib/functions/k2t.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2018 Weijie Gao <hackpascal@gmail.com>
|
||||
#
|
||||
# Helper function to extract mac addresses from mtd part for Phicomm K2T
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
k2t_config_load() {
|
||||
local mtd_blk=$(find_mtd_part config)
|
||||
|
||||
if [ -z "$mtd_blk" ]; then
|
||||
echo "k2t_config_load: no mtd part named config" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local json_size=$(dd if=$mtd_blk bs=1 count=8 2>/dev/null)
|
||||
|
||||
json_size="0x$json_size"
|
||||
json_size=$((json_size))
|
||||
|
||||
if [ "$?" -ne 0 ]; then
|
||||
echo "k2t_config_load: invalid json data size" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ "$json_size" -eq 0 ]; then
|
||||
echo "k2t_config_load: empty json data" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
local json_data=$(dd if=$mtd_blk bs=1 skip=8 count=$json_size 2>/dev/null)
|
||||
|
||||
json_load "$json_data"
|
||||
}
|
||||
|
||||
k2t_get_mac() {
|
||||
local old_ns
|
||||
|
||||
json_set_namespace "k2t" old_ns
|
||||
|
||||
if k2t_config_load; then
|
||||
json_select "this_dev_info"
|
||||
json_get_var val "$1"
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
json_set_namespace old_ns
|
||||
|
||||
echo $val
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright (C) 2011 OpenWrt.org
|
||||
#
|
||||
|
||||
PART_NAME=firmware
|
||||
REQUIRE_IMAGE_METADATA=1
|
||||
|
||||
redboot_fis_do_upgrade() {
|
||||
local append
|
||||
local sysup_file="$1"
|
||||
local kern_part="$2"
|
||||
local magic=$(get_magic_word "$sysup_file")
|
||||
|
||||
if [ "$magic" = "4349" ]; then
|
||||
local kern_length=0x$(dd if="$sysup_file" bs=2 skip=1 count=4 2>/dev/null)
|
||||
|
||||
[ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
|
||||
dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \
|
||||
mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs
|
||||
|
||||
elif [ "$magic" = "7379" ]; then
|
||||
local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$')
|
||||
local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c)
|
||||
|
||||
[ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP"
|
||||
tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \
|
||||
mtd -r $append -F$kern_part:$kern_length:0x80060000,rootfs write - $kern_part:rootfs
|
||||
|
||||
else
|
||||
echo "Unknown image, aborting!"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
platform_check_image() {
|
||||
return 0
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
adtran,bsap1800-v2|\
|
||||
adtran,bsap1840)
|
||||
redboot_fis_do_upgrade "$1" vmlinux_2
|
||||
;;
|
||||
jjplus,ja76pf2)
|
||||
echo "Sysupgrade disabled due bug FS#2428"
|
||||
;;
|
||||
ubnt,routerstation|\
|
||||
ubnt,routerstation-pro)
|
||||
echo "Sysupgrade disabled due bug FS#2428"
|
||||
;;
|
||||
zyxel,nbg6716)
|
||||
nand_do_upgrade "$1"
|
||||
;;
|
||||
*)
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user