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/sepolicy/eth_mac_addr.te b/sepolicy/eth_mac_addr.te
new file mode 100644
index 0000000..d2e4e1a
--- /dev/null
+++ b/sepolicy/eth_mac_addr.te
@@ -0,0 +1,12 @@
+type eth_mac_addr, domain, coredomain;
+type eth_mac_addr_exec, exec_type, system_file_type, file_type;
+init_daemon_domain(eth_mac_addr);
+
+allow eth_mac_addr proc_cmdline:file { open read };
+allow eth_mac_addr rootfs:dir { open read };
+allow eth_mac_addr self:capability net_admin;
+allow eth_mac_addr self:netlink_route_socket { bind create getattr nlmsg_readpriv nlmsg_write read setopt write };
+allow eth_mac_addr self:udp_socket { create ioctl };
+allow eth_mac_addr shell_exec:file { execute getattr map read };
+allow eth_mac_addr system_file:file execute_no_trans;
+allow eth_mac_addr toolbox_exec:file { execute execute_no_trans getattr map open read };
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 165f3b3..247e1ab 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -29,6 +29,8 @@
 /data/vendor/readwrite(/.*)?								u:object_r:tqftpserv_vendor_data_file:s0
 /data/vendor/readonly(/.*)?								u:object_r:tqftpserv_vendor_data_file:s0
 
+/system/bin/eth_mac_addr\.sh								u:object_r:eth_mac_addr_exec:s0
+
 /vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software			u:object_r:hal_gatekeeper_default_exec:s0
 /vendor/bin/pd-mapper									u:object_r:pd_mapper_exec:s0
 /vendor/bin/qrtr-cfg									u:object_r:qrtr_exec:s0