diff options
author | DENG Qingfang <dengqf6@mail2.sysu.edu.cn> | 2020-04-19 15:53:03 +0800 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-06-03 20:34:15 +0200 |
commit | 9b34ea4f62bb4c4ad16b791c24e905775f2a52fd (patch) | |
tree | 3a3cd3e162b8ee61c5756aeb3d0d6cc95b4d2ddc /target/linux/mvebu/cortexa9/base-files | |
parent | 4149d2b91c43784ada37efe928c5f6b610c74259 (diff) | |
download | upstream-9b34ea4f62bb4c4ad16b791c24e905775f2a52fd.tar.gz upstream-9b34ea4f62bb4c4ad16b791c24e905775f2a52fd.tar.bz2 upstream-9b34ea4f62bb4c4ad16b791c24e905775f2a52fd.zip |
mvebu: use ucidef to set up MAC address
Use ucidef to set up MAC address instead of preinit script
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
Diffstat (limited to 'target/linux/mvebu/cortexa9/base-files')
-rwxr-xr-x | target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network | 113 |
1 files changed, 75 insertions, 38 deletions
diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index a2290ce532..89ccedae3f 100755 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -4,49 +4,86 @@ # Copyright (C) 2016 LEDE-Project.org # +. /lib/functions.sh . /lib/functions/uci-defaults.sh +. /lib/functions/system.sh -board_config_update +mvebu_setup_interfaces() +{ + local board="$1" -board=$(board_name) + case "$board" in + cznic,turris-omnia) + ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2" + ;; + linksys,caiman|\ + linksys,cobra|\ + linksys,mamba|\ + linksys,rango|\ + linksys,shelby|\ + linksys,venom) + 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-a1|\ + 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" + ;; + solidrun,clearfog-base-a1) + # eth0 is standalone ethernet + # eth1 is standalone ethernet + # eth2 is SFP + ucidef_set_interfaces_lan_wan "eth1" "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 -cznic,turris-omnia) - ucidef_set_interface_lan "lan0 lan1 lan2 lan3 lan4" - ucidef_set_interface_wan "eth2" - ;; -linksys,caiman|\ -linksys,cobra|\ -linksys,mamba|\ -linksys,rango|\ -linksys,shelby|\ -linksys,venom) - 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-a1|\ -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" - ;; -solidrun,clearfog-base-a1) - # eth0 is standalone ethernet - # eth1 is standalone ethernet - # eth2 is SFP - ucidef_set_interfaces_lan_wan "eth1" "eth0 eth2" - ;; -*) - ucidef_set_interface_lan "eth0" - ;; -esac + case "$board" in + buffalo,ls421de) + lan_mac=$(mtd_get_mac_ascii u-boot-env eth1addr) + ;; + linksys,caiman|\ + linksys,cobra|\ + linksys,rango|\ + linksys,shelby|\ + linksys,venom) + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + wan_mac=$(macaddr_setbit_la $label_mac) + ;; + linksys,mamba) + 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 |