kirkwood: rework 02_network
Just like other targets do, introduce two setup functions for interfaces and MAC addresses. Signed-off-by: Sungbo Eo <mans0n@gorani.run>
This commit is contained in:
parent
aaebc7aa2e
commit
0c568d044f
1 changed files with 68 additions and 43 deletions
|
@ -5,9 +5,9 @@
|
||||||
. /lib/functions/uci-defaults.sh
|
. /lib/functions/uci-defaults.sh
|
||||||
. /lib/functions/system.sh
|
. /lib/functions/system.sh
|
||||||
|
|
||||||
board_config_update
|
kirkwood_setup_interfaces()
|
||||||
|
{
|
||||||
board=$(board_name)
|
local board="$1"
|
||||||
|
|
||||||
case "$board" in
|
case "$board" in
|
||||||
checkpoint,l-50)
|
checkpoint,l-50)
|
||||||
|
@ -28,7 +28,9 @@ seagate,blackarmor-nas220|\
|
||||||
seagate,dockstar|\
|
seagate,dockstar|\
|
||||||
seagate,goflexhome|\
|
seagate,goflexhome|\
|
||||||
seagate,goflexnet|\
|
seagate,goflexnet|\
|
||||||
zyxel,nsa310s)
|
zyxel,nsa310b|\
|
||||||
|
zyxel,nsa310s|\
|
||||||
|
zyxel,nsa325)
|
||||||
ucidef_set_interface_lan "eth0" "dhcp"
|
ucidef_set_interface_lan "eth0" "dhcp"
|
||||||
;;
|
;;
|
||||||
endian,4i-edge-200)
|
endian,4i-edge-200)
|
||||||
|
@ -38,18 +40,41 @@ linksys,e4200-v2|\
|
||||||
linksys,ea3500|\
|
linksys,ea3500|\
|
||||||
linksys,ea4500)
|
linksys,ea4500)
|
||||||
ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
|
ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
|
||||||
ucidef_set_interface_macaddr "wan" $( mtd_get_mac_ascii u_env eth1addr )
|
|
||||||
;;
|
|
||||||
zyxel,nsa310b|\
|
|
||||||
zyxel,nsa325)
|
|
||||||
ucidef_set_interface_lan "eth0" "dhcp"
|
|
||||||
ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr )
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
ucidef_set_interface_lan "eth0"
|
ucidef_set_interface_lan "eth0"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
kirkwood_setup_macs()
|
||||||
|
{
|
||||||
|
local board="$1"
|
||||||
|
local lan_mac=""
|
||||||
|
local wan_mac=""
|
||||||
|
local label_mac=""
|
||||||
|
|
||||||
|
case "$board" in
|
||||||
|
linksys,e4200-v2|\
|
||||||
|
linksys,ea3500|\
|
||||||
|
linksys,ea4500)
|
||||||
|
wan_mac=$(mtd_get_mac_ascii u_env eth1addr)
|
||||||
|
;;
|
||||||
|
zyxel,nsa310b|\
|
||||||
|
zyxel,nsa325)
|
||||||
|
lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
|
||||||
|
;;
|
||||||
|
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)
|
||||||
|
kirkwood_setup_interfaces $board
|
||||||
|
kirkwood_setup_macs $board
|
||||||
board_config_flush
|
board_config_flush
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue