2 # Copyright (C) 2009 OpenWrt.org
11 mtd=$(grep $mtd_part /proc/mtd | cut -d: -f1)
14 mac=$(grep $lan_env /dev/$mtd | cut -d= -f2)
15 [ ! -z $mac ] && ifconfig eth0 hw ether $mac 2>/dev/null
17 mac=$(grep $wan_env /dev/$mtd | cut -d= -f2)
18 [ ! -z $mac ] && ifconfig eth1 hw ether $mac 2>/dev/null
21 preinit_set_mac_address() {
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
34 fetch_mac_from_mtd nvram sys_lan_mac sys_wan_mac
37 mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
38 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
41 mac_lan=$(mtd_get_mac_binary caldata 0)
42 [ -n "$mac_lan" ] && ifconfig eth1 hw ether "$mac_lan"
43 mac_wan=$(mtd_get_mac_binary caldata 6)
44 [ -n "$mac_wan" ] && ifconfig eth0 hw ether "$mac_wan"
47 mac_lan=$(mtd_get_mac_binary art 0)
48 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
49 mac_wan=$(mtd_get_mac_binary art 6)
50 [ -n "$mac_wan" ] && ifconfig eth1 hw ether "$mac_wan"
53 fetch_mac_from_mtd config lan_mac wan_mac
56 fetch_mac_from_mtd nvram lan_hwaddr wan_hwaddr
59 mac_lan=$(mtd_get_mac_binary_ubi board-config 102)
60 [ -n "$mac_lan" ] && ifconfig eth0 hw ether "$mac_lan"
65 boot_hook_add preinit_main preinit_set_mac_address