add Huawei D105
[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 mzk-w300nh2 |\
16 wl-330n |\
17 wl-330n3g)
18 mac=$(mtd_get_mac_binary factory 4)
19 ifconfig eth0 hw ether $mac 2>/dev/null
20 ;;
21 bc2 |\
22 broadway |\
23 d105 |\
24 dir-620-a1 |\
25 esr-9753 |\
26 freestation5 |\
27 nw718 |\
28 psr-680w |\
29 rt-n56u |\
30 sl-r7205)
31 mac=$(mtd_get_mac_binary factory 4)
32 mac=$(macaddr_setbit_la "$mac")
33 ifconfig eth0 hw ether $mac 2>/dev/null
34 ;;
35 dir-300-b1 |\
36 dir-300-b2 |\
37 dir-600-b1)
38 mac=$(mtd_get_mac_binary devdata 16388)
39 ifconfig eth0 hw ether $mac 2>/dev/null
40 ;;
41 dir-645)
42 mac=$(mtd_get_mac_ascii nvram lanmac)
43 mac=$(macaddr_setbit_la "$mac")
44 ifconfig eth0 hw ether $mac 2>/dev/null
45 ;;
46 dap-1350)
47 mac=$(mtd_get_mac_binary devdata 46)
48 ifconfig eth0 hw ether $mac 2>/dev/null
49 ;;
50 all0239-3g |\
51 all0256n |\
52 all5002 |\
53 carambola |\
54 dir-615-h1 |\
55 fonera20n |\
56 rt-n13u |\
57 hw550-3g |\
58 nbg-419n |\
59 omni-emb |\
60 omni-emb-hpm |\
61 tew-691gr |\
62 tew-692gr |\
63 w306r-v20 |\
64 w502u |\
65 wr6202 |\
66 xdxrn502j)
67 mac=$(mtd_get_mac_binary factory 40)
68 ifconfig eth0 hw ether $mac 2>/dev/null
69 ;;
70 wl341v3)
71 mac=$(mtd_get_mac_binary board-nvram 65440)
72 ifconfig eth0 hw ether $mac 2>/dev/null
73 ;;
74 rt-n10-plus)
75 mac=$(mtd_get_mac_binary devconf 4)
76 ifconfig eth0 hw ether $mac 2>/dev/null
77 ;;
78 esac
79 }
80
81 boot_hook_add preinit_main preinit_set_mac_address