[ar71xx] init mac address on the TEW-632BRP boards (closes #5403)
[openwrt-10.03/.git] / target / linux / ar71xx / base-files / etc / preinit.arch
1 #
2 # Copyright (C) 2009 OpenWrt.org
3 #
4
5 . /lib/ar71xx.sh
6
7 tew632brp_init_mac_address() {
8         local mtd mac
9
10         mtd=$(grep config /proc/mtd | cut -d: -f1)
11         [ -z $mtd ] && return
12
13         mac=$(grep lan_mac /dev/$mtd | cut -d= -f2)
14         [ ! -z $mac ] && ifconfig eth0 hw ether $mac 2>/dev/null
15
16         mac=$(grep wan_mac /dev/$mtd | cut -d= -f2)
17         [ ! -z $mac ] && ifconfig eth1 hw ether $mac 2>/dev/null
18 }
19
20 case $(ar71xx_board_name) in
21         tew-632brp)
22                 tew632brp_init_mac_address
23                 ;;
24 esac