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. In certain cases, keeping files in parent (=target) base-files was more convenient, and thus no splitting was performed for those. Note that this will increase overall code lines, but reduce code per subtarget. base-files ipk size reduction: master (mt7621) 60958 B split (mt7620) 46358 B (- 14.3 kiB) split (mt7621) 48759 B (- 11.9 kiB) split (mt76x8) 44948 B (- 15.6 kiB) split (rt288x) 43508 B (- 17.0 kiB) split (rt305x) 45616 B (- 15.0 kiB) split (rt3883) 44176 B (- 16.4 kiB) Run-tested on: GL.iNet GL-MT300N-V2 (mt76x8) D-Link DWR-116 (mt7620) Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
35 lines
683 B
Bash
Executable file
35 lines
683 B
Bash
Executable file
#!/bin/sh
|
|
|
|
. /lib/functions/leds.sh
|
|
. /lib/functions/uci-defaults.sh
|
|
|
|
set_wifi_led() {
|
|
ucidef_set_led_netdev "wifi_led" "wifi" "${1}" "${2:-wlan0}"
|
|
}
|
|
|
|
|
|
board=$(board_name)
|
|
boardname="${board##*,}"
|
|
|
|
board_config_update
|
|
|
|
led_wlan="$(get_dt_led wlan)"
|
|
[ -n "$led_wlan" ] && ucidef_set_led_wlan "wifi_led" "wifi" "$led_wlan" "phy0tpt"
|
|
|
|
case $board in
|
|
belkin,f9k1109v1)
|
|
set_usb_led "$boardname:green:usb1"
|
|
ucidef_set_led_netdev "lan" "lan" "$boardname:blue:wps" "eth0"
|
|
;;
|
|
edimax,br-6475nd)
|
|
set_wifi_led "$boardname:amber:wlan"
|
|
;;
|
|
omnima,hpm)
|
|
ucidef_set_led_netdev "eth" "ETH" "$boardname:green:eth" "eth0"
|
|
set_wifi_led "$boardname:green:wifi"
|
|
;;
|
|
esac
|
|
|
|
board_config_flush
|
|
|
|
exit 0
|