a605b22f8cc433259775e2ccefc270ceeb001650
[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 bc2 |\
12 esr-9753 |\
13 freestation5 |\
14 nw718 |\
15 psr-680w |\
16 rt-n56u |\
17 sl-r7205)
18 mac=$(ramips_get_mac_binary factory 4)
19 mac=$(maccalc or "$mac" "02:00:00:00:00:00")
20 ifconfig eth0 hw ether $mac 2>/dev/null
21 ;;
22 dir-300-b1 |\
23 dir-300-b2 |\
24 dir-600-b1)
25 mac=$(ramips_get_mac_binary devdata 16388)
26 ifconfig eth0 hw ether $mac 2>/dev/null
27 ;;
28 all0256n |\
29 fonera20n |\
30 hw550-3g |\
31 nbg-419n |\
32 omni-emb |\
33 w306r-v20 |\
34 w502u |\
35 wl-330n |\
36 wl-330n3g |\
37 wr6202 |\
38 xdxrn502j)
39 mac=$(ramips_get_mac_binary factory 40)
40 ifconfig eth0 hw ether $mac 2>/dev/null
41 ;;
42 wl341v3)
43 mac=$(ramips_get_mac_binary board-nvram 65440)
44 ifconfig eth0 hw ether $mac 2>/dev/null
45 ;;
46 rt-n10-plus)
47 mac=$(ramips_get_mac_binary devconf 4)
48 ifconfig eth0 hw ether $mac 2>/dev/null
49 ;;
50 esac
51 }
52
53 boot_hook_add preinit_main preinit_set_mac_address