ramips: add user-space support for the Tenda 3G300M
[openwrt/openwrt.git] / target / linux / ramips / base-files / lib / preinit / 06_set_iface_mac
1 #
2 # Copyright (C) 2011 OpenWrt.org
3 #
4
5 preinit_set_mac_address() {
6 local mac
7
8 . /lib/ramips.sh
9
10 case $(ramips_board_name) in
11 3g-6200n |\
12 3g300m | \
13 mzk-w300nh2 |\
14 wl-330n |\
15 wl-330n3g)
16 mac=$(ramips_get_mac_binary factory 4)
17 ifconfig eth0 hw ether $mac 2>/dev/null
18 ;;
19 bc2 |\
20 broadway |\
21 dir-620-a1 |\
22 esr-9753 |\
23 freestation5 |\
24 nw718 |\
25 psr-680w |\
26 rt-n56u |\
27 sl-r7205)
28 mac=$(ramips_get_mac_binary factory 4)
29 mac=$(maccalc or "$mac" "02:00:00:00:00:00")
30 ifconfig eth0 hw ether $mac 2>/dev/null
31 ;;
32 dir-300-b1 |\
33 dir-300-b2 |\
34 dir-600-b1)
35 mac=$(ramips_get_mac_binary devdata 16388)
36 ifconfig eth0 hw ether $mac 2>/dev/null
37 ;;
38 dir-645)
39 mac=$(ramips_get_mac_nvram nvram lanmac)
40 mac=$(maccalc or "$mac" "02:00:00:00:00:00")
41 ifconfig eth0 hw ether $mac 2>/dev/null
42 ;;
43 dap-1350)
44 mac=$(ramips_get_mac_binary devdata 46)
45 ifconfig eth0 hw ether $mac 2>/dev/null
46 ;;
47 all0239-3g |\
48 all0256n |\
49 all5002 |\
50 carambola |\
51 dir-615-h1 |\
52 fonera20n |\
53 rt-n13u |\
54 hw550-3g |\
55 nbg-419n |\
56 omni-emb |\
57 tew-691gr |\
58 tew-692gr |\
59 w306r-v20 |\
60 w502u |\
61 wr6202 |\
62 xdxrn502j)
63 mac=$(ramips_get_mac_binary factory 40)
64 ifconfig eth0 hw ether $mac 2>/dev/null
65 ;;
66 wl341v3)
67 mac=$(ramips_get_mac_binary board-nvram 65440)
68 ifconfig eth0 hw ether $mac 2>/dev/null
69 ;;
70 rt-n10-plus)
71 mac=$(ramips_get_mac_binary devconf 4)
72 ifconfig eth0 hw ether $mac 2>/dev/null
73 ;;
74 esac
75 }
76
77 boot_hook_add preinit_main preinit_set_mac_address