init mac address on the TEW-632BRP boards (closes #5403)
authorGabor Juhos <juhosg@openwrt.org>
Mon, 3 Aug 2009 07:48:21 +0000 (07:48 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Mon, 3 Aug 2009 07:48:21 +0000 (07:48 +0000)
SVN-Revision: 17100

target/linux/ar71xx/base-files/etc/preinit.arch [new file with mode: 0644]

diff --git a/target/linux/ar71xx/base-files/etc/preinit.arch b/target/linux/ar71xx/base-files/etc/preinit.arch
new file mode 100644 (file)
index 0000000..6e09039
--- /dev/null
@@ -0,0 +1,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