Initial commit
This commit is contained in:
55
target/linux/mvebu/base-files/etc/board.d/01_leds
Executable file
55
target/linux/mvebu/base-files/etc/board.d/01_leds
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2014-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
armada-385-linksys-caiman)
|
||||
ucidef_set_led_netdev "wan" "WAN" "pca963x:caiman:white:wan" "eth1"
|
||||
ucidef_set_led_usbport "usb1" "USB 1" "pca963x:caiman:white:usb2" "usb1-port1"
|
||||
ucidef_set_led_usbport "usb2" "USB 2" "pca963x:caiman:white:usb3_1" "usb2-port1" "usb3-port1"
|
||||
ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:caiman:white:usb3_2" "usb3-port1"
|
||||
;;
|
||||
armada-385-linksys-cobra)
|
||||
ucidef_set_led_netdev "wan" "WAN" "pca963x:cobra:white:wan" "eth1"
|
||||
ucidef_set_led_usbport "usb1" "USB 1" "pca963x:cobra:white:usb2" "usb1-port1"
|
||||
ucidef_set_led_usbport "usb2" "USB 2" "pca963x:cobra:white:usb3_1" "usb2-port1" "usb3-port1"
|
||||
ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:cobra:white:usb3_2" "usb3-port1"
|
||||
;;
|
||||
armada-385-linksys-rango)
|
||||
ucidef_set_led_netdev "wan" "WAN" "pca963x:rango:white:wan" "eth1"
|
||||
ucidef_set_led_usbport "usb1" "USB 1" "pca963x:rango:white:usb2" "usb1-port1"
|
||||
ucidef_set_led_usbport "usb2" "USB 2" "pca963x:rango:white:usb3_1" "usb2-port1" "usb3-port1"
|
||||
ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:rango:white:usb3_2" "usb3-port1"
|
||||
;;
|
||||
armada-385-linksys-shelby)
|
||||
ucidef_set_led_netdev "wan" "WAN" "pca963x:shelby:white:wan" "eth1"
|
||||
ucidef_set_led_usbport "usb1" "USB 1" "pca963x:shelby:white:usb2" "usb1-port1"
|
||||
ucidef_set_led_usbport "usb2" "USB 2" "pca963x:shelby:white:usb3_1" "usb2-port1" "usb3-port1"
|
||||
ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:shelby:white:usb3_2" "usb3-port1"
|
||||
;;
|
||||
armada-385-linksys-venom)
|
||||
ucidef_set_led_netdev "wan" "WAN" "pca963x:venom:blue:wan" "eth1"
|
||||
ucidef_set_led_usbport "usb1" "USB 1" "pca963x:venom:blue:usb2" "usb1-port1"
|
||||
ucidef_set_led_usbport "usb2" "USB 2" "pca963x:venom:blue:usb3_1" "usb2-port1" "usb3-port1"
|
||||
ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "pca963x:venom:blue:usb3_2" "usb3-port1"
|
||||
;;
|
||||
armada-xp-linksys-mamba)
|
||||
ucidef_set_led_netdev "wan" "WAN" "mamba:white:wan" "eth1"
|
||||
ucidef_set_led_usbport "usb1" "USB 1" "mamba:white:usb2" "usb1-port1"
|
||||
ucidef_set_led_usbport "usb2" "USB 2" "mamba:white:usb3_1" "usb2-port1" "usb3-port1"
|
||||
ucidef_set_led_usbport "usb2_ss" "USB 2 SS" "mamba:white:usb3_2" "usb3-port2"
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
59
target/linux/mvebu/base-files/etc/board.d/02_network
Executable file
59
target/linux/mvebu/base-files/etc/board.d/02_network
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2014-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
armada-385-db-ap)
|
||||
ucidef_set_interfaces_lan_wan "eth0 eth1" "eth2"
|
||||
;;
|
||||
armada-385-linksys-caiman|\
|
||||
armada-385-linksys-cobra|\
|
||||
armada-385-linksys-rango|\
|
||||
armada-385-linksys-shelby|\
|
||||
armada-385-linksys-venom|\
|
||||
armada-xp-linksys-mamba)
|
||||
ucidef_set_interfaces_lan_wan "eth0.1" "eth1.2"
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5@eth0" "4:wan" "6@eth1"
|
||||
;;
|
||||
armada-385-turris-omnia)
|
||||
ucidef_set_interface_lan "lan0 lan1 lan2 lan3 lan4"
|
||||
ucidef_set_interface_wan "eth2"
|
||||
;;
|
||||
armada-388-clearfog-*)
|
||||
# eth0 is standalone ethernet
|
||||
# eth1 is switch (-pro) or standalone ethernet (-base)
|
||||
# eth2 is SFP
|
||||
ucidef_set_interfaces_lan_wan "eth1" "eth0 eth2"
|
||||
|
||||
# if switch exists (clearfog-pro)
|
||||
# switch port 5 is connected to eth1
|
||||
swconfig list 2>&1 | grep -q switch0 && \
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan:5" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5u@eth1" "6:lan:6"
|
||||
;;
|
||||
armada-xp-gp)
|
||||
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
|
||||
;;
|
||||
globalscale,espressobin)
|
||||
ucidef_set_interfaces_lan_wan "lan0 lan1" "wan"
|
||||
;;
|
||||
marvell,armada8040-mcbin)
|
||||
ucidef_set_interfaces_lan_wan "eth0 eth1 eth3" "eth2"
|
||||
;;
|
||||
*)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
48
target/linux/mvebu/base-files/etc/diag.sh
Normal file
48
target/linux/mvebu/base-files/etc/diag.sh
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2014-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/leds.sh
|
||||
|
||||
get_status_led() {
|
||||
case $(board_name) in
|
||||
armada-385-linksys-caiman)
|
||||
status_led="caiman:white:power"
|
||||
;;
|
||||
armada-385-linksys-cobra)
|
||||
status_led="cobra:white:power"
|
||||
;;
|
||||
armada-385-linksys-rango)
|
||||
status_led="rango:white:power"
|
||||
;;
|
||||
armada-385-linksys-shelby)
|
||||
status_led="shelby:white:power"
|
||||
;;
|
||||
armada-385-linksys-venom)
|
||||
status_led="venom:blue:power"
|
||||
;;
|
||||
armada-xp-linksys-mamba)
|
||||
status_led="mamba:white:power"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
set_state() {
|
||||
get_status_led
|
||||
|
||||
case "$1" in
|
||||
preinit)
|
||||
status_led_blink_preinit
|
||||
;;
|
||||
failsafe)
|
||||
status_led_blink_failsafe
|
||||
;;
|
||||
preinit_regular)
|
||||
status_led_blink_preinit_regular
|
||||
;;
|
||||
done)
|
||||
status_led_on
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The pcie-controller device was renamed to pcie in Linux kernel 4.14
|
||||
# commit 28fbb9c539e2 ("ARM: dts: marvell: fix PCI bus dtc warnings").
|
||||
# This script migrates the path in the UCI configuration from the old
|
||||
# name to the new name and also back, when am upgrade or downgrade is
|
||||
# done. It checks if the name exists before changing the configuration.
|
||||
# This has to be done before the 10-wifi-detect script from mac80211 is
|
||||
# executed because this would add the devices again under the new path
|
||||
# name.
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
PATH_CHANGED=0
|
||||
|
||||
rename_wifi_path() {
|
||||
local path_old=$(uci get wireless.${1}.path)
|
||||
local path_new=$(echo ${path_old} | sed "${2}")
|
||||
|
||||
if [ -e "/sys/devices/platform/${path_new}" ] && [ ${path_old} != ${path_new} ]
|
||||
then
|
||||
uci set wireless.${1}.path=${path_new}
|
||||
PATH_CHANGED=1
|
||||
fi
|
||||
}
|
||||
|
||||
rename_wifi_path_list() {
|
||||
# migration from kernel 4.9 to 4.14
|
||||
rename_wifi_path $1 "s/soc:pcie-controller/soc:pcie/"
|
||||
# migration from kernel 4.14 to 4.9
|
||||
rename_wifi_path $1 "s/soc:pcie/soc:pcie-controller/"
|
||||
}
|
||||
|
||||
[ "${ACTION}" = "add" ] && {
|
||||
[ ! -e /etc/config/wireless ] && return
|
||||
|
||||
config_load wireless
|
||||
config_foreach rename_wifi_path_list wifi-device
|
||||
|
||||
[ "$PATH_CHANGED" = "1" ] && uci commit wireless
|
||||
}
|
||||
20
target/linux/mvebu/base-files/etc/init.d/linksys_recovery
Executable file
20
target/linux/mvebu/base-files/etc/init.d/linksys_recovery
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
# Copyright (C) 2016 LEDE-Project.org
|
||||
|
||||
START=97
|
||||
boot() {
|
||||
. /lib/functions.sh
|
||||
|
||||
case $(board_name) in
|
||||
armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-rango|armada-385-linksys-shelby|armada-385-linksys-venom|armada-xp-linksys-mamba)
|
||||
# make sure auto_recovery in uboot is always on
|
||||
AUTO_RECOVERY_ENA="`fw_printenv -n auto_recovery`"
|
||||
if [ "$AUTO_RECOVERY_ENA" != "yes" ] ; then
|
||||
fw_setenv auto_recovery yes
|
||||
fi
|
||||
# reset the boot counter
|
||||
mtd resetbc s_env
|
||||
;;
|
||||
esac
|
||||
}
|
||||
56
target/linux/mvebu/base-files/etc/uci-defaults/03_wireless
Normal file
56
target/linux/mvebu/base-files/etc/uci-defaults/03_wireless
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
#
|
||||
|
||||
[ ! -e /etc/config/wireless ] && exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|armada-385-linksys-venom|armada-xp-linksys-mamba)
|
||||
SKU=$(strings /dev/mtd3|sed -ne 's/^cert_region=//p')
|
||||
WIFIMAC2G=$(macaddr_add $(cat /sys/class/net/eth0/address) +1)
|
||||
WIFIMAC5G=$(macaddr_add $WIFIMAC2G +1)
|
||||
case "$SKU" in
|
||||
AP)
|
||||
REGD=CN
|
||||
;;
|
||||
AU)
|
||||
REGD=AU
|
||||
;;
|
||||
CA)
|
||||
REGD=CA
|
||||
;;
|
||||
EU)
|
||||
REGD=DE
|
||||
;;
|
||||
US)
|
||||
REGD=US
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$board" in
|
||||
armada-xp-linksys-mamba)
|
||||
WIFIMAC0=$WIFIMAC2G
|
||||
WIFIMAC1=$WIFIMAC5G
|
||||
;;
|
||||
*)
|
||||
WIFIMAC0=$WIFIMAC5G
|
||||
WIFIMAC1=$WIFIMAC2G
|
||||
;;
|
||||
esac
|
||||
|
||||
uci get wireless.radio0.country || uci set wireless.radio0.country=$REGD
|
||||
uci get wireless.@wifi-iface[0].macaddr || uci set wireless.@wifi-iface[0].macaddr=$WIFIMAC0
|
||||
uci get wireless.radio1.country || uci set wireless.radio1.country=$REGD
|
||||
uci get wireless.@wifi-iface[1].macaddr || uci set wireless.@wifi-iface[1].macaddr=$WIFIMAC1
|
||||
;;
|
||||
esac
|
||||
|
||||
uci commit wireless
|
||||
|
||||
exit 0
|
||||
23
target/linux/mvebu/base-files/etc/uci-defaults/04_mambafan
Normal file
23
target/linux/mvebu/base-files/etc/uci-defaults/04_mambafan
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2017 LEDE-Project.org
|
||||
#
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
armada-xp-linksys-mamba)
|
||||
# Set fan script execution in crontab
|
||||
grep -s -q fan_ctrl.sh /etc/crontabs/root && exit 0
|
||||
|
||||
echo "# mamba fan script runs every 5 minutes" >> /etc/crontabs/root
|
||||
echo "*/5 * * * * /sbin/fan_ctrl.sh" >> /etc/crontabs/root
|
||||
|
||||
# Execute one time after initial flash (instead of waiting 5 min for cron)
|
||||
/sbin/fan_ctrl.sh
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user