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