| 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 | dir-620-a1 |\ |
| 17 | esr-9753 |\ |
| 18 | freestation5 |\ |
| 19 | nw718 |\ |
| 20 | psr-680w |\ |
| 21 | rt-n56u |\ |
| 22 | sl-r7205) |
| 23 | mac=$(ramips_get_mac_binary factory 4) |
| 24 | mac=$(maccalc or "$mac" "02:00:00:00:00:00") |
| 25 | ifconfig eth0 hw ether $mac 2>/dev/null |
| 26 | ;; |
| 27 | dir-300-b1 |\ |
| 28 | dir-300-b2 |\ |
| 29 | dir-600-b1) |
| 30 | mac=$(ramips_get_mac_binary devdata 16388) |
| 31 | ifconfig eth0 hw ether $mac 2>/dev/null |
| 32 | ;; |
| 33 | dap-1350) |
| 34 | mac=$(ramips_get_mac_binary devdata 46) |
| 35 | ifconfig eth0 hw ether $mac 2>/dev/null |
| 36 | ;; |
| 37 | all0239-3g |\ |
| 38 | all0256n |\ |
| 39 | all5002 |\ |
| 40 | carambola |\ |
| 41 | dir-615-h1 |\ |
| 42 | fonera20n |\ |
| 43 | hw550-3g |\ |
| 44 | nbg-419n |\ |
| 45 | omni-emb |\ |
| 46 | w306r-v20 |\ |
| 47 | w502u |\ |
| 48 | wl-330n |\ |
| 49 | wl-330n3g |\ |
| 50 | wr6202 |\ |
| 51 | xdxrn502j) |
| 52 | mac=$(ramips_get_mac_binary factory 40) |
| 53 | ifconfig eth0 hw ether $mac 2>/dev/null |
| 54 | ;; |
| 55 | wl341v3) |
| 56 | mac=$(ramips_get_mac_binary board-nvram 65440) |
| 57 | ifconfig eth0 hw ether $mac 2>/dev/null |
| 58 | ;; |
| 59 | rt-n10-plus) |
| 60 | mac=$(ramips_get_mac_binary devconf 4) |
| 61 | ifconfig eth0 hw ether $mac 2>/dev/null |
| 62 | ;; |
| 63 | esac |
| 64 | } |
| 65 | |
| 66 | boot_hook_add preinit_main preinit_set_mac_address |
| 67 | |