summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/base-files/etc/preinit.arch
blob: 6e09039059eac8f1854e0154c28c1b776879a6c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#
# Copyright (C) 2009 OpenWrt.org
#

. /lib/ar71xx.sh

tew632brp_init_mac_address() {
	local mtd mac

	mtd=$(grep config /proc/mtd | cut -d: -f1)
	[ -z $mtd ] && return

	mac=$(grep lan_mac /dev/$mtd | cut -d= -f2)
	[ ! -z $mac ] && ifconfig eth0 hw ether $mac 2>/dev/null

	mac=$(grep wan_mac /dev/$mtd | cut -d= -f2)
	[ ! -z $mac ] && ifconfig eth1 hw ether $mac 2>/dev/null
}

case $(ar71xx_board_name) in
	tew-632brp)
		tew632brp_init_mac_address
		;;
esac