2015-12-04 14:32:52 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2013-2015 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
2015-12-11 15:26:06 +00:00
|
|
|
. /lib/functions/uci-defaults.sh
|
2021-10-18 04:20:03 +00:00
|
|
|
. /lib/functions/system.sh
|
2015-12-04 14:32:52 +00:00
|
|
|
|
2021-10-18 04:20:03 +00:00
|
|
|
sunxi_setup_interfaces()
|
|
|
|
{
|
|
|
|
local board="$1"
|
|
|
|
|
|
|
|
case "$board" in
|
|
|
|
friendlyarm,nanopi-r1|\
|
|
|
|
friendlyarm,nanopi-r1s-h5)
|
|
|
|
ucidef_set_interfaces_lan_wan "eth1" "eth0"
|
|
|
|
;;
|
|
|
|
lamobo,lamobo-r1)
|
|
|
|
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
|
|
|
|
;;
|
|
|
|
olimex,a20-olinuxino-micro)
|
|
|
|
ucidef_set_interface_lan "wlan0"
|
|
|
|
;;
|
|
|
|
xunlong,orangepi-r1)
|
|
|
|
ucidef_set_interfaces_lan_wan "eth0" "eth1"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
ucidef_set_interface_lan "eth0"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
sunxi_setup_macs()
|
|
|
|
{
|
|
|
|
local board="$1"
|
|
|
|
local lan_mac=""
|
|
|
|
local wan_mac=""
|
|
|
|
local label_mac=""
|
2015-12-04 14:32:52 +00:00
|
|
|
|
2021-10-18 04:20:03 +00:00
|
|
|
case "$board" in
|
|
|
|
friendlyarm,nanopi-r1s-h5)
|
|
|
|
lan_mac=$(get_mac_binary "/sys/bus/i2c/devices/0-0051/eeprom" 0xfa)
|
|
|
|
;;
|
|
|
|
esac
|
2015-12-04 14:32:52 +00:00
|
|
|
|
2021-10-18 04:20:03 +00:00
|
|
|
[ -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)
|
|
|
|
sunxi_setup_interfaces $board
|
|
|
|
sunxi_setup_macs $board
|
2015-12-04 14:32:52 +00:00
|
|
|
board_config_flush
|
|
|
|
|
|
|
|
exit 0
|