Initial commit
This commit is contained in:
46
target/linux/apm821xx/base-files/etc/board.d/01_leds
Executable file
46
target/linux/apm821xx/base-files/etc/board.d/01_leds
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
meraki,mr24)
|
||||
ucidef_set_led_netdev "wan" "WAN" "mr24:green:wan" "eth0"
|
||||
ucidef_set_led_wlan "wlan1" "WLAN1" "mr24:green:wifi1" "phy0assoc"
|
||||
ucidef_set_led_wlan "wlan2" "WLAN2" "mr24:green:wifi2" "phy0assoc"
|
||||
ucidef_set_led_wlan "wlan3" "WLAN3" "mr24:green:wifi3" "phy0assoc"
|
||||
ucidef_set_led_wlan "wlan4" "WLAN4" "mr24:green:wifi4" "phy0tpt"
|
||||
;;
|
||||
|
||||
meraki,mx60)
|
||||
ucidef_set_led_switch "wan" "WAN" "mx60:green:wan" "switch0" "0x20"
|
||||
ucidef_set_led_switch "lan1" "LAN1" "mx60:green:lan1" "switch0" "0x10"
|
||||
ucidef_set_led_switch "lan2" "LAN2" "mx60:green:lan2" "switch0" "0x08"
|
||||
ucidef_set_led_switch "lan3" "LAN3" "mx60:green:lan3" "switch0" "0x04"
|
||||
ucidef_set_led_switch "lan4" "LAN4" "mx60:green:lan4" "switch0" "0x02"
|
||||
;;
|
||||
|
||||
wd,mybooklive|\
|
||||
wd,mybooklive-duo)
|
||||
ucidef_set_led_ide "sata" "SATA" "mbl:blue:power"
|
||||
;;
|
||||
|
||||
netgear,wndr4700)
|
||||
ucidef_set_led_ide "sata" "SATA" "wndr4700:green:hd"
|
||||
ucidef_set_led_switch "wan_green" "WAN (green)" "wndr4700:green:wan" "switch0" "0x20"
|
||||
ucidef_set_led_netdev "wan_yellow" "WAN (yellow)" "wndr4700:yellow:wan" "eth0.2" "tx rx"
|
||||
ucidef_set_led_usbport "usb3" "USB3" "wndr4700:blue:usb" "usb2-port1" "usb2-port2" "usb3-port1" "usb3-port2"
|
||||
ucidef_set_led_wlan "wlan2g" "WLAN2G" "wndr4700:blue:wlan" "phy0tpt"
|
||||
ucidef_set_led_wlan "wlan5g" "WLAN5G" "wndr4700:blue:wlan" "phy1tpt"
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
30
target/linux/apm821xx/base-files/etc/board.d/02_network
Executable file
30
target/linux/apm821xx/base-files/etc/board.d/02_network
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
meraki,mr24|\
|
||||
wd,mybooklive|\
|
||||
wd,mybooklive-duo)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
;;
|
||||
|
||||
meraki,mx60|\
|
||||
netgear,wndr4700)
|
||||
ucidef_add_switch "switch0" \
|
||||
"0@eth0" "4:lan" "3:lan" "2:lan" "1:lan" "5:wan"
|
||||
;;
|
||||
|
||||
*)
|
||||
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
44
target/linux/apm821xx/base-files/etc/diag.sh
Executable file
44
target/linux/apm821xx/base-files/etc/diag.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/leds.sh
|
||||
|
||||
boot="$(get_dt_led boot)"
|
||||
failsafe="$(get_dt_led failsafe)"
|
||||
running="$(get_dt_led running)"
|
||||
upgrade="$(get_dt_led upgrade)"
|
||||
|
||||
set_state() {
|
||||
status_led="$boot"
|
||||
|
||||
case "$1" in
|
||||
preinit_regular)
|
||||
status_led_blink_preinit_regular
|
||||
;;
|
||||
preinit)
|
||||
status_led_blink_preinit
|
||||
;;
|
||||
failsafe)
|
||||
status_led_off
|
||||
[ -n "$running" ] && {
|
||||
status_led="$running"
|
||||
status_led_off
|
||||
}
|
||||
status_led="$failsafe"
|
||||
status_led_blink_failsafe
|
||||
;;
|
||||
upgrade)
|
||||
[ -n "$running" ] && {
|
||||
status_led="$upgrade"
|
||||
status_led_blink_preinit_regular
|
||||
}
|
||||
;;
|
||||
done)
|
||||
status_led_off
|
||||
[ -n "$running" ] && {
|
||||
status_led="$running"
|
||||
status_led_on
|
||||
}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -e /lib/firmware/$FIRMWARE ] && exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
ath9k_eeprom_die() {
|
||||
echo "ath9k eeprom: " "$*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ath9k_eeprom_extract() {
|
||||
local part=$1
|
||||
local offset=$2
|
||||
local count=$3
|
||||
local mtd
|
||||
|
||||
mtd=$(find_mtd_chardev $part)
|
||||
[ -n "$mtd" ] || \
|
||||
ath9k_eeprom_die "no mtd device found for partition $part"
|
||||
|
||||
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
||||
ath9k_eeprom_die "failed to extract from $mtd"
|
||||
}
|
||||
|
||||
ath9k_ubi_eeprom_extract() {
|
||||
local part=$1
|
||||
local offset=$2
|
||||
local count=$3
|
||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||
local ubi
|
||||
|
||||
ubi=$(nand_find_volume $ubidev $part)
|
||||
[ -n "$ubi" ] || \
|
||||
ath9k_eeprom_die "no UBI volume found for $part"
|
||||
|
||||
dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \
|
||||
ath9k_eeprom_die "failed to extract from $ubi"
|
||||
}
|
||||
|
||||
ath9k_patch_firmware_mac() {
|
||||
local mac=$1
|
||||
|
||||
[ -z "$mac" ] && return
|
||||
|
||||
macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=2 count=6
|
||||
}
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$FIRMWARE" in
|
||||
"pci_wmac0.eeprom")
|
||||
case $board in
|
||||
netgear,wndr4700)
|
||||
. /lib/upgrade/nand.sh
|
||||
|
||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||
ath9k_ubi_eeprom_extract "caldata" 20480 4096
|
||||
else
|
||||
ath9k_eeprom_extract "wifi_data" 20480 4096
|
||||
ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 12)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
ath9k_eeprom_die "board $board is not supported yet"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"pci_wmac1.eeprom")
|
||||
case $board in
|
||||
netgear,wndr4700)
|
||||
. /lib/upgrade/nand.sh
|
||||
|
||||
if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
|
||||
ath9k_ubi_eeprom_extract "caldata" 4096 4096
|
||||
else
|
||||
ath9k_eeprom_extract "wifi_data" 4096 4096
|
||||
ath9k_patch_firmware_mac $(mtd_get_mac_binary wifi_data 0)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
ath9k_eeprom_die "board $board is not supported yet"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
4
target/linux/apm821xx/base-files/etc/inittab
Normal file
4
target/linux/apm821xx/base-files/etc/inittab
Normal file
@@ -0,0 +1,4 @@
|
||||
::sysinit:/etc/init.d/rcS S boot
|
||||
::shutdown:/etc/init.d/rcS K shutdown
|
||||
::askconsole:/usr/libexec/login.sh
|
||||
ttyS0::askfirst:/usr/libexec/login.sh
|
||||
18
target/linux/apm821xx/base-files/etc/rc.button/BTN_1
Executable file
18
target/linux/apm821xx/base-files/etc/rc.button/BTN_1
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
BOARD=$(board_name)
|
||||
|
||||
if [ $BOARD == "netgear,wndr4700" ]; then
|
||||
case "$ACTION" in
|
||||
released)
|
||||
rmmod dwc2
|
||||
;;
|
||||
pressed)
|
||||
modprobe dwc2
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
return 0
|
||||
Reference in New Issue
Block a user