2 # Copyright (C) 2009 OpenWrt.org
13 mtd=$(grep $mtd_part /proc/mtd | cut -d: -f1)
16 mac=$(grep $lan_env /dev/$mtd | cut -d= -f2)
17 [ ! -z $mac ] && ifconfig eth0 hw ether $mac 2>/dev/null
19 mac=$(grep $wan_env /dev/$mtd | cut -d= -f2)
20 [ ! -z $mac ] && ifconfig eth1 hw ether $mac 2>/dev/null
23 preinit_set_mac_address() {
24 case $(ar71xx_board_name) in
27 mac_lan=$(mtd_get_mac_binary art 0)
28 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
31 fetch_mac_from_mtd config lan_mac wan_mac
32 echo 1 > /sys/class/leds/dir-615-c1:green:wancpu/brightness
35 fetch_mac_from_mtd nvram sys_lan_mac sys_wan_mac
38 mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
39 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
42 mac_lan=$(mtd_get_mac_binary caldata 0)
43 [ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
44 mac_wan=$(mtd_get_mac_binary caldata 6)
45 [ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
48 mac_lan=$(mtd_get_mac_binary art 0)
49 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
50 mac_wan=$(mtd_get_mac_binary art 6)
51 [ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
54 fetch_mac_from_mtd config lan_mac wan_mac
57 fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
60 mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
61 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
66 boot_hook_add preinit_main preinit_set_mac_address