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