You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
1.9 KiB
Bash
89 lines
1.9 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Copyright (C) 2014-2016 OpenWrt.org
|
|
# Copyright (C) 2016 LEDE-Project.org
|
|
#
|
|
|
|
. /lib/functions.sh
|
|
. /lib/functions/uci-defaults.sh
|
|
. /lib/functions/system.sh
|
|
|
|
mvebu_setup_interfaces()
|
|
{
|
|
local board="$1"
|
|
|
|
case "$board" in
|
|
cznic,turris-omnia)
|
|
ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2"
|
|
;;
|
|
linksys,wrt1200ac|\
|
|
linksys,wrt1900ac-v1|\
|
|
linksys,wrt1900ac-v2|\
|
|
linksys,wrt1900acs|\
|
|
linksys,wrt3200acm|\
|
|
linksys,wrt32x)
|
|
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
|
|
;;
|
|
marvell,a385-db-ap)
|
|
ucidef_set_interfaces_lan_wan "eth0 eth1" "eth2"
|
|
;;
|
|
marvell,axp-gp)
|
|
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
|
|
;;
|
|
solidrun,clearfog-base-a1)
|
|
# eth0 is standalone ethernet
|
|
# eth1 is standalone ethernet
|
|
# eth2 is SFP
|
|
ucidef_set_interfaces_lan_wan "eth1" "eth0 eth2"
|
|
;;
|
|
solidrun,clearfog-pro-a1)
|
|
# eth0 is standalone ethernet
|
|
# eth1 is switch
|
|
# eth2 is SFP
|
|
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6" "eth0 eth2"
|
|
;;
|
|
*)
|
|
ucidef_set_interface_lan "eth0"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
mvebu_setup_macs()
|
|
{
|
|
local board="$1"
|
|
local lan_mac=""
|
|
local wan_mac=""
|
|
local label_mac=""
|
|
|
|
case "$board" in
|
|
buffalo,ls421de)
|
|
lan_mac=$(mtd_get_mac_ascii u-boot-env eth1addr)
|
|
;;
|
|
linksys,wrt1200ac|\
|
|
linksys,wrt1900ac-v2|\
|
|
linksys,wrt1900acs|\
|
|
linksys,wrt3200acm|\
|
|
linksys,wrt32x)
|
|
label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
|
|
wan_mac=$(macaddr_setbit_la $label_mac)
|
|
;;
|
|
linksys,wrt1900ac-v1)
|
|
label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
|
|
lan_mac=$label_mac
|
|
wan_mac=$label_mac
|
|
;;
|
|
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)
|
|
mvebu_setup_interfaces $board
|
|
mvebu_setup_macs $board
|
|
board_config_flush
|
|
|
|
exit 0
|