ramips: introduce DTS for ALL5003
[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         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         nw718 |\
30         psr-680w |\
31         rt-n56u |\
32         sl-r7205)
33                 mac=$(mtd_get_mac_binary factory 4)
34                 mac=$(macaddr_setbit_la "$mac")
35                 ifconfig eth0 hw ether $mac 2>/dev/null
36                 ;;
37         asl26555 |\
38         dir-300-b1 |\
39         dir-300-b2 |\
40         dir-600-b1)
41                 mac=$(mtd_get_mac_binary devdata 16388)
42                 ifconfig eth0 hw ether $mac 2>/dev/null
43                 ;;
44         dir-645)
45                 mac=$(mtd_get_mac_ascii nvram lanmac)
46                 mac=$(macaddr_setbit_la "$mac")
47                 ifconfig eth0 hw ether $mac 2>/dev/null
48                 ;;
49         dap-1350)
50                 mac=$(mtd_get_mac_binary devdata 46)
51                 ifconfig eth0 hw ether $mac 2>/dev/null
52                 ;;
53         all0239-3g |\
54         all0256n |\
55         all5002 |\
56         all5003 |\
57         carambola |\
58         dir-615-h1 |\
59         fonera20n |\
60         rt-n13u |\
61         hw550-3g |\
62         nbg-419n |\
63         omni-emb |\
64         omni-emb-hpm |\
65         tew-691gr |\
66         tew-692gr |\
67         w306r-v20 |\
68         w502u    |\
69         wr6202 |\
70         wnce2001 |\
71         xdxrn502j)
72                 mac=$(mtd_get_mac_binary factory 40)
73                 ifconfig eth0 hw ether $mac 2>/dev/null
74                 ;;
75         wl341v3)
76                 mac=$(mtd_get_mac_binary board-nvram 65440)
77                 ifconfig eth0 hw ether $mac 2>/dev/null
78                 ;;
79         rt-n10-plus)
80                 mac=$(mtd_get_mac_binary devconf 4)
81                 ifconfig eth0 hw ether $mac 2>/dev/null
82                 ;;
83         esac
84 }
85
86 boot_hook_add preinit_main preinit_set_mac_address