ramips: add support for the ARC FreeStation5 board, also fix WCR-150GN network setup...
[openwrt.git] / target / linux / ramips / base-files / etc / uci-defaults / network
1 #!/bin/sh
2
3 . /etc/functions.sh
4 . /lib/ramips.sh
5 . /lib/functions/uci-defaults.sh
6
7 if [ ! -x /usr/sbin/maccalc ]; then
8 echo "$0: maccalc not found!"
9 return
10 fi
11
12 ramips_setup_interfaces()
13 {
14 local board="$1"
15
16 ucidef_set_interface_loopback
17
18 case $board in
19 all0256n | \
20 wl-330n)
21 ucidef_set_interface_lan "eth0.1"
22 ;;
23
24 argus-atp52b | \
25 b2c | \
26 nw718 | \
27 sl-r7205 | \
28 w502u | \
29 wr6202)
30 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
31 ;;
32
33 f5d8235-v1 | \
34 f5d8235-v2 | \
35 v11st-fe)
36 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
37 ucidef_add_switch "switch0" "1" "1"
38 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
39 ucidef_add_switch_vlan "switch0" "2" "0 5t"
40 ;;
41
42 rt-n15 | \
43 wl-351)
44 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
45 ucidef_add_switch "switch0" "1" "1"
46 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 5t"
47 ucidef_add_switch_vlan "switch0" "2" "4 5t"
48 ;;
49
50 rt-n56u)
51 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
52 ucidef_add_switch "switch0" "1" "1"
53 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
54 ucidef_add_switch_vlan "switch0" "2" "4 8t"
55 ;;
56
57 freestation5 | \
58 wcr-150gn)
59 ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
60 ;;
61
62 wli-tx4-ag300n)
63 ucidef_set_interface_lan "eth0"
64 ;;
65
66 *)
67 RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
68 if [ -n "${RT3X5X}" ]; then
69 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
70 else
71 ucidef_set_interfaces_lan_wan "eth0" "eth1"
72 fi
73 ;;
74 esac
75 }
76
77 ramips_setup_macs()
78 {
79 local board="$1"
80 local lan_mac=""
81 local wan_mac=""
82
83 case $board in
84 all0256n)
85 lan_mac=$(ramips_get_mac_binary factory 40)
86 ;;
87
88 argus-atp52b | \
89 b2c | \
90 f5d8235-v1 | \
91 nw718 | \
92 rt-n15 | \
93 sl-r7205 | \
94 wl-351)
95 lan_mac=$(ramips_get_mac_binary factory 4)
96 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
97 ;;
98
99 dir-300-b1 |\
100 dir-300-b2 |\
101 dir-600-b1)
102 lan_mac=$(ramips_get_mac_binary devdata 16388)
103 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
104 ;;
105
106 esr-9753 | \
107 nbg-419n | \
108 wcr-150gn)
109 lan_mac=$(ramips_get_mac_binary factory 4)
110 wan_mac=$(ramips_get_mac_binary factory 40)
111 ;;
112
113 f5d8235-v2)
114 lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
115 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
116 ;;
117
118 rt-n56u)
119 lan_mac=$(ramips_get_mac_binary factory 4)
120 wan_mac=$(ramips_get_mac_binary factory 32772)
121 ;;
122
123 w502u)
124 lan_mac=$(ramips_get_mac_binary factory 40)
125 wan_mac=$(ramips_get_mac_binary factory 46)
126 ;;
127
128 wl341v3)
129 lan_mac=$(ramips_get_mac_binary board-nvram 65440)
130 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
131 ;;
132
133 wli-tx4-ag300n)
134 lan_mac=$(ramips_get_mac_binary factory 4)
135 ;;
136
137 esac
138
139 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
140 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
141 }
142
143 [ -e /etc/config/network ] && exit 0
144
145 touch /etc/config/network
146
147 board=$(ramips_board_name)
148
149 ramips_setup_interfaces $board
150 ramips_setup_macs $board
151
152 uci commit network
153
154 exit 0
This page took 0.049366 seconds and 5 git commands to generate.