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