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