5 .
/lib
/functions
/uci-defaults.sh
7 if [ ! -x /usr
/sbin
/maccalc
]; then
8 echo "$0: maccalc not found!"
12 ramips_get_mac_binary
()
18 part
=$
(find_mtd_part
"$mtdname")
19 if [ -z "$part" ]; then
20 echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
24 dd bs
=1 skip
=$seek count
=6 if=$part 2>/dev
/null |
/usr
/sbin
/maccalc bin2mac
27 ramips_get_mac_nvram
()
34 part
=$
(find_mtd_part
"$mtdname")
35 if [ -z "$part" ]; then
36 echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
40 mac_dirty
=$
(strings "$part" |
sed -n 's/'"$key"'=//p')
42 maccalc add
"$mac_dirty" 0
45 ramips_setup_interfaces
()
49 ucidef_set_interface_loopback
56 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
60 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
61 ucidef_add_switch
"rtl8366s" "1" "1"
62 ucidef_add_switch_vlan
"rtl8366s" "1" "1 2 3 4 5t"
63 ucidef_add_switch_vlan
"rtl8366s" "2" "0 5t"
67 RT3X5X
=`cat /proc/cpuinfo | grep RT3.5`
68 if [ -n "${RT3X5X}" ]; then
69 ucidef_set_interfaces_lan_wan
"eth0.1" "eth0.2"
71 ucidef_set_interfaces_lan_wan
"eth0" "eth1"
85 lan_mac
=$
(ramips_get_mac_nvram
"u-boot" 262148)
86 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
93 lan_mac
=$
(ramips_get_mac_binary factory
4)
94 wan_mac
=$
(/usr
/sbin
/maccalc add
"$lan_mac" 1)
98 [ -n $lan_mac ] && ucidef_set_interface_macaddr lan
$lan_mac
99 [ -n $wan_mac ] && ucidef_set_interface_macaddr wan
$wan_mac
102 [ -e /etc
/config
/network
] && exit 0
104 touch /etc
/config
/network
106 board
=$
(ramips_board_name
)
108 ramips_setup_interfaces
$board
109 ramips_setup_macs
$board