5 .
/lib
/functions
/uci-defaults.sh
7 if [ ! -x /usr
/sbin
/maccalc
]; then
8 echo "$0: maccalc not found!"
12 ramips_setup_interfaces
()
16 ucidef_set_interface_loopback
20 ucidef_set_interface_lan
"eth0.1"
29 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
35 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
36 ucidef_add_switch
"switch0" "1" "1"
37 ucidef_add_switch_vlan
"switch0" "1" "1 2 3 4 5t"
38 ucidef_add_switch_vlan
"switch0" "2" "0 5t"
43 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
44 ucidef_add_switch
"switch0" "1" "1"
45 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 5t"
46 ucidef_add_switch_vlan
"switch0" "2" "4 5t"
50 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
51 ucidef_add_switch
"switch0" "1" "1"
52 ucidef_add_switch_vlan
"switch0" "1" "0 1 2 3 8t"
53 ucidef_add_switch_vlan
"switch0" "2" "4 8t"
57 ucidef_set_interface_lan_wan
"eth0.2" "eth0.1"
61 ucidef_set_interface_lan
"eth0"
65 RT3X5X
=`cat /proc/cpuinfo | grep RT3.5`
66 if [ -n "${RT3X5X}" ]; then
67 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
69 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
83 lan_mac
=$
(ramips_get_mac_binary factory
40)
93 lan_mac
=$
(ramips_get_mac_binary factory
4)
94 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
100 lan_mac
=$
(ramips_get_mac_binary devdata
16388)
101 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
107 lan_mac
=$
(ramips_get_mac_binary factory
4)
108 wan_mac
=$
(ramips_get_mac_binary factory
40)
112 lan_mac
=$
(ramips_get_mac_binary
"u-boot" 262148)
113 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
117 lan_mac
=$
(ramips_get_mac_binary factory
4)
118 wan_mac
=$
(ramips_get_mac_binary factory
32772)
122 lan_mac
=$
(ramips_get_mac_binary factory
40)
123 wan_mac
=$
(ramips_get_mac_binary factory
46)
127 lan_mac
=$
(ramips_get_mac_binary board-nvram
65440)
128 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
132 lan_mac
=$
(ramips_get_mac_binary factory
4)
137 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan
$lan_mac
138 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan
$wan_mac
141 [ -e /etc
/config
/network
] && exit 0
143 touch /etc
/config
/network
145 board
=$
(ramips_board_name
)
147 ramips_setup_interfaces
$board
148 ramips_setup_macs
$board