fbf56c5e0ce98e41eb17cacd263922aff7fd0d9e
[openwrt/staging/chunkeey.git] / target / linux / ipq806x / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
4 # Copyright (c) 2011-2015 OpenWrt.org
5 #
6
7 . /lib/functions/uci-defaults.sh
8 . /lib/functions/system.sh
9
10 board_config_update
11
12 board=$(board_name)
13
14 case "$board" in
15 asrock,g10 |\
16 nec,wg2600hp)
17 ucidef_add_switch "switch0" \
18 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
19 ;;
20 buffalo,wxr-2533dhp |\
21 compex,wpq864 |\
22 netgear,d7800 |\
23 netgear,r7500 |\
24 netgear,r7500v2 |\
25 qcom,ipq8064-ap148 |\
26 tplink,vr2600v)
27 ucidef_add_switch "switch0" \
28 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
29 ;;
30 edgecore,ecw5410)
31 ucidef_set_interfaces_lan_wan "eth1" "eth0"
32 ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary "0:ART" 0x6)"
33 ucidef_set_interface_macaddr "wan" "$(mtd_get_mac_binary "0:ART" 0x0)"
34 ;;
35 linksys,ea7500-v1)
36 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
37 ucidef_add_switch "switch0" \
38 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
39 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
40 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
41 ;;
42 linksys,ea8500)
43 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
44 ucidef_add_switch "switch0" \
45 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
46 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
47 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
48 ;;
49 nec,wg2600hp3)
50 ucidef_add_switch "switch0" \
51 "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
52 ;;
53 netgear,r7800 |\
54 tplink,ad7200 |\
55 tplink,c2600)
56 ucidef_add_switch "switch0" \
57 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
58 ;;
59 qcom,ipq8064-ap161)
60 ucidef_set_interface_lan "eth1 eth2"
61 ucidef_add_switch "switch0" \
62 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
63 ;;
64 qcom,ipq8064-db149)
65 ucidef_set_interface_lan "eth1 eth2 eth3"
66 ucidef_add_switch "switch0" \
67 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
68 ;;
69 zyxel,nbg6817)
70 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
71 ucidef_add_switch "switch0" \
72 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
73 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
74 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
75 ;;
76 *)
77 echo "Unsupported hardware. Network interfaces not intialized"
78 ;;
79 esac
80
81 board_config_flush
82
83 exit 0