ralink: Add support for samsung cy-swr1100 wireless router
[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/functions.sh
9 . /lib/ramips.sh
10
11 case $(ramips_board_name) in
12 3g-6200n |\
13 3g-6200nl |\
14 3g300m | \
15 dir-620-d1 |\
16 dir-300-b7 | \
17 w150m | \
18 mzk-w300nh2 |\
19 wl-330n |\
20 wl-330n3g)
21 mac=$(mtd_get_mac_binary factory 4)
22 ifconfig eth0 hw ether $mac 2>/dev/null
23 ;;
24 bc2 |\
25 broadway |\
26 d105 |\
27 dir-620-a1 |\
28 esr-9753 |\
29 freestation5 |\
30 hlk-rm04 | \
31 mpr-a1 | \
32 mpr-a2 | \
33 dir-300-b7 | \
34 dir-320-b1 | \
35 psr-680w |\
36 rt-n56u |\
37 sl-r7205)
38 mac=$(mtd_get_mac_binary factory 4)
39 mac=$(macaddr_setbit_la "$mac")
40 ifconfig eth0 hw ether $mac 2>/dev/null
41 ;;
42 br-6475nd)
43 mac=$(mtd_get_mac_binary devdata 13)
44 ifconfig eth0 hw ether $mac 2>/dev/null
45 ;;
46 asl26555 |\
47 dir-300-b1 |\
48 dir-300-b2 |\
49 dir-600-b1 |\
50 dir-610-a1)
51 mac=$(mtd_get_mac_binary devdata 16388)
52 ifconfig eth0 hw ether $mac 2>/dev/null
53 ;;
54 cy-swr1100 |\
55 dir-645)
56 mac=$(mtd_get_mac_ascii nvram lanmac)
57 mac=$(macaddr_setbit_la "$mac")
58 ifconfig eth0 hw ether $mac 2>/dev/null
59 ;;
60 dap-1350)
61 mac=$(mtd_get_mac_binary devdata 46)
62 ifconfig eth0 hw ether $mac 2>/dev/null
63 ;;
64 all0239-3g |\
65 all0256n |\
66 all5002 |\
67 all5003 |\
68 awm002-evb |\
69 carambola |\
70 dir-615-h1 |\
71 fonera20n |\
72 ip2202 |\
73 rt-n13u |\
74 hw550-3g |\
75 nbg-419n |\
76 omni-emb |\
77 omni-emb-hpm |\
78 px4885 |\
79 tew-691gr |\
80 tew-692gr |\
81 w306r-v20 |\
82 w502u |\
83 wr6202 |\
84 wnce2001 |\
85 xdxrn502j)
86 mac=$(mtd_get_mac_binary factory 40)
87 ifconfig eth0 hw ether $mac 2>/dev/null
88 ;;
89 m3 |\
90 m4 |\
91 x5 |\
92 x8)
93 mac=$(mtd_get_mac_binary factory 4)
94 mac=$(macaddr_add "$mac" -1)
95 ifconfig eth0 hw ether $mac 2>/dev/null
96 ;;
97 wl341v3)
98 mac=$(mtd_get_mac_binary board-nvram 65440)
99 ifconfig eth0 hw ether $mac 2>/dev/null
100 ;;
101 rt-n10-plus)
102 mac=$(mtd_get_mac_binary devconf 4)
103 ifconfig eth0 hw ether $mac 2>/dev/null
104 ;;
105 esac
106 }
107
108 boot_hook_add preinit_main preinit_set_mac_address