ramips: rt305x: add support for the Skyline SL-R7205 Wireless 3G router
[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 ucidef_set_interface_lan "eth0.1"
21 ;;
22
23 argus-atp52b | \
24 b2c | \
25 nw718 | \
26 sl-r7205 | \
27 w502u | \
28 wr6202)
29 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
30 ;;
31
32 f5d8235-v1 | \
33 rt-n15)
34 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
35 ucidef_add_switch "rtl8366s" "1" "1"
36 ucidef_add_switch_vlan "rtl8366s" "1" "1 2 3 4 5t"
37 ucidef_add_switch_vlan "rtl8366s" "2" "0 5t"
38 ;;
39
40 f5d8235-v2)
41 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
42 ucidef_add_switch "rtl8366rb" "1" "1"
43 ucidef_add_switch_vlan "rtl8366rb" "1" "1 2 3 4 5t"
44 ucidef_add_switch_vlan "rtl8366rb" "2" "0 5t"
45 ;;
46
47 rt-n56u)
48 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
49 ucidef_add_switch "switch0" "1" "1"
50 ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 8t"
51 ucidef_add_switch_vlan "switch0" "2" "4 8t"
52 ;;
53
54 v11st-fe)
55 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
56 ucidef_add_switch "switch0" "1" "1"
57 ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5t"
58 ucidef_add_switch_vlan "switch0" "2" "0 5t"
59 ;;
60
61 wcr-150gn)
62 ucidef_set_interface_lan_wan "eth0.2" "eth0.1"
63 ;;
64
65 wl-351)
66 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
67 ucidef_add_switch "rtl8366rb" "1" "1"
68 ucidef_add_switch_vlan "rtl8366rb" "1" "0 1 2 3 5t"
69 ucidef_add_switch_vlan "rtl8366rb" "2" "4 5t"
70 ;;
71
72 wli-tx4-ag300n)
73 ucidef_set_interface_lan "eth0"
74 ;;
75
76 *)
77 RT3X5X=`cat /proc/cpuinfo | grep RT3.5`
78 if [ -n "${RT3X5X}" ]; then
79 ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
80 else
81 ucidef_set_interfaces_lan_wan "eth0" "eth1"
82 fi
83 ;;
84 esac
85 }
86
87 ramips_setup_macs()
88 {
89 local board="$1"
90 local lan_mac=""
91 local wan_mac=""
92
93 case $board in
94 all0256n)
95 lan_mac=$(ramips_get_mac_binary factory 40)
96 ;;
97
98 argus-atp52b | \
99 b2c | \
100 f5d8235-v1 | \
101 nw718 | \
102 rt-n15 | \
103 sl-r7205 | \
104 wl-351)
105 lan_mac=$(ramips_get_mac_binary factory 4)
106 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
107 ;;
108
109 dir-300-b1 |\
110 dir-300-b2 |\
111 dir-600-b1)
112 lan_mac=$(ramips_get_mac_binary devdata 16388)
113 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
114 ;;
115
116 esr-9753 | \
117 nbg-419n | \
118 wcr-150gn)
119 lan_mac=$(ramips_get_mac_binary factory 4)
120 wan_mac=$(ramips_get_mac_binary factory 40)
121 ;;
122
123 f5d8235-v2)
124 lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
125 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
126 ;;
127
128 rt-n56u)
129 lan_mac=$(ramips_get_mac_binary factory 4)
130 wan_mac=$(ramips_get_mac_binary factory 32772)
131 ;;
132
133 w502u)
134 lan_mac=$(ramips_get_mac_binary factory 40)
135 wan_mac=$(ramips_get_mac_binary factory 46)
136 ;;
137
138 wl341v3)
139 lan_mac=$(ramips_get_mac_binary board-nvram 65440)
140 wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
141 ;;
142
143 wli-tx4-ag300n)
144 lan_mac=$(ramips_get_mac_binary factory 4)
145 ;;
146
147 esac
148
149 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
150 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
151 }
152
153 [ -e /etc/config/network ] && exit 0
154
155 touch /etc/config/network
156
157 board=$(ramips_board_name)
158
159 ramips_setup_interfaces $board
160 ramips_setup_macs $board
161
162 uci commit network
163
164 exit 0
This page took 0.050344 seconds and 5 git commands to generate.