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