121b471f4f399e7b2100c17dc53a569e459401e2
[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         nw718 |\
13         esr-9753)
14                 mac=$(ramips_get_mac_binary factory 4)
15                 mac=$(maccalc or "$mac" "02:00:00:00:00:00")
16                 ifconfig eth0 hw ether $mac 2>/dev/null
17                 ;;
18         dir-300-b1 |\
19         dir-300-b2 |\
20         dir-600-b1)
21                 mac=$(ramips_get_mac_binary devdata 16388)
22                 ifconfig eth0 hw ether $mac 2>/dev/null
23                 ;;
24         all0256n |\
25         hw550-3g |\
26         nbg-419n |\
27         omni-emb |\
28         w502u    |\
29         wr6202)
30                 mac=$(ramips_get_mac_binary factory 40)
31                 ifconfig eth0 hw ether $mac 2>/dev/null
32                 ;;
33         wl341v3)
34                 mac=$(ramips_get_mac_binary board-nvram 65440)
35                 ifconfig eth0 hw ether $mac 2>/dev/null
36                 ;;
37         esac
38 }
39
40 boot_hook_add preinit_main preinit_set_mac_address