ath79: move base-files for ZyXEL NBG6716
[openwrt/openwrt.git] / target / linux / ath79 / nand / base-files / etc / board.d / 02_network
1 #!/bin/sh
2
3 . /lib/functions/system.sh
4 . /lib/functions/uci-defaults.sh
5
6 ath79_setup_interfaces()
7 {
8 local board="$1"
9
10 case "$board" in
11 aerohive,hiveap-121)
12 ucidef_set_interface_lan "eth0"
13 ;;
14 zyxel,nbg6716)
15 ucidef_add_switch "switch0" \
16 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "6@eth1"
17 ;;
18 *)
19 ucidef_set_interfaces_lan_wan "eth0" "eth1"
20 ;;
21 esac
22 }
23
24 ath79_setup_macs()
25 {
26 local board="$1"
27
28 case "$board" in
29 zyxel,nbg6716)
30 lan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2)
31 wan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3)
32 ;;
33 esac
34
35 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
36 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
37 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
38 }
39
40 board_config_update
41 board=$(board_name)
42 ath79_setup_interfaces $board
43 ath79_setup_macs $board
44 board_config_flush
45
46 exit 0