db845c: Set Ethernet MAC address on boot

db845c development boards do not have unique
Ethernet MAC address. All boards share same
MAC address and it cause problems while
running CTS tests on db845c in a lab with
multiple db845c boards connected.

Set the Ethernet MAC address based on board's
unique serial number as a workaround for now.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I1c5b63b7d6cbf5e55ac40980b5823cc6bb4f44d3
diff --git a/db845c/eth_mac_addr.sh b/db845c/eth_mac_addr.sh
new file mode 100644
index 0000000..bdc1ba7
--- /dev/null
+++ b/db845c/eth_mac_addr.sh
@@ -0,0 +1,15 @@
+#! /system/bin/sh
+# Set eth0 mac address.
+#
+# Get the unique board serial number from /proc/cmdline,
+# prepend '0's to the serial number to fill 5 LSBs of the
+# MAC address and prepend "02" as MSB to prepare a 6 byte
+# locally administered unicast MAC address.
+# Format the output in xx:xx:xx:xx:xx:xx format for the
+# "ip" set address command to work.
+
+SERIALNO=`cat /proc/cmdline | grep -o serialno.* | cut -f2 -d'=' | awk '{printf("02%010s\n", $1)}' | sed 's/\(..\)/\1:/g' | sed '$s/:$//'`
+
+/system/bin/ip link set dev eth0 down
+/system/bin/ip link set dev eth0 address "${SERIALNO}"
+/system/bin/ip link set dev eth0 up