meta-ampere: mtmitchell: set BMC MAC address from FRU

Update the MAC address via BMC FRU data, the MAC address is based on
"Board extra information 1". BMC FRU device is detected based on i2c bus
index and address.

Tested:
1. Clear environment and then reboot BMC.
2. Wait for BMC to boot complete, check for eth0 to have MAC Address the
same value defined in FRU at Board Extra.

Signed-off-by: Thang Tran <thuutran@amperecomputing.com>
Change-Id: I5d644109143e4d600b92e23e3f1627986e827768
diff --git a/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf b/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf
index c821cb1..a2d43c9 100644
--- a/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf
+++ b/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf
@@ -30,6 +30,7 @@
                                    ampere-ipmi-oem \
                                    ampere-hostctrl \
                                    ampere-driver-binder \
+                                   ampere-mac-update \
                                    phosphor-ipmi-blobs \
                                    phosphor-ipmi-blobs-binarystore \
                                    util-linux \
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-mac-update.bb b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-mac-update.bb
new file mode 100644
index 0000000..7deb05a
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-mac-update.bb
@@ -0,0 +1,18 @@
+SUMMARY = "Ampere Computing LLC Update MAC Address from FRU Inventory Information"
+DESCRIPTION = "Update MAC Address from FRU Inventory Information for Ampere systems"
+PR = "r1"
+
+LICENSE = "Apache-2.0"
+
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+inherit systemd
+inherit obmc-phosphor-systemd
+
+DEPENDS = "systemd"
+RDEPENDS:${PN} = "bash"
+
+FILESEXTRAPATHS:append := "${THISDIR}/${PN}:"
+
+SYSTEMD_SERVICE:${PN} = "ampere_update_mac.service"
+
diff --git a/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service
new file mode 100644
index 0000000..f68f029
--- /dev/null
+++ b/meta-ampere/meta-mitchell/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Updating MAC Address Service From FRU inventory
+Requires=xyz.openbmc_project.EntityManager.service
+After=xyz.openbmc_project.EntityManager.service
+StartLimitInterval=25
+StartLimitBurst=5
+
+[Service]
+ExecStart=/usr/bin/env ampere_update_mac.sh eth0 14 80
+SyslogIdentifier=ampere_update_mac.sh
+RemainAfterExit=yes
+Restart=on-failure
+RestartSec=5
+
+[Install]
+WantedBy={SYSTEMD_DEFAULT_TARGET}