fix up mac address setting on ixp4xx for devices that store this info in the RedBoot...
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx / base-files / etc / preinit.arch
diff --git a/target/linux/ixp4xx/base-files/etc/preinit.arch b/target/linux/ixp4xx/base-files/etc/preinit.arch
new file mode 100755 (executable)
index 0000000..1ee1d74
--- /dev/null
@@ -0,0 +1,8 @@
+RB_CONFIG="$(grep "RedBoot config" /proc/mtd | cut -d: -f1)"
+
+for npe in eth0 eth1
+do
+       if [ "$(ifconfig $npe 2>/dev/null | grep -c 00:00:00:00:00:00)" == "1" ]; then
+               ifconfig $npe hw ether $(fconfig -s -r -d /dev/$RB_CONFIG -n npe_"$npe"_esa)
+       fi
+done