meta-ampere: mac-update: MAC update with static IP

When the IP Address is configured to static IP, changing BMC MAC Address
in FRU does not change the MAC address in eth0. This commit fixes the
issue by adding IPMI MAC address update and some other configuration via
ipmitool lan set commands to ampere_update_mac.sh to ensure the update
is taking effect.

Signed-off-by: HuyLe <hule@amperecomputing.com>
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: Ib0466ee130af6d294fed03587c4d96328221d017
diff --git a/meta-ampere/meta-common/recipes-ampere/platform/ampere-utils/ampere_update_mac.sh b/meta-ampere/meta-common/recipes-ampere/platform/ampere-utils/ampere_update_mac.sh
index 6b86245..6be938a 100644
--- a/meta-ampere/meta-common/recipes-ampere/platform/ampere-utils/ampere_update_mac.sh
+++ b/meta-ampere/meta-common/recipes-ampere/platform/ampere-utils/ampere_update_mac.sh
@@ -52,6 +52,23 @@
 	exit
 fi
 
+# Check eth port
+case ${ETHERNET_INTERFACE} in
+	"eth0")
+		ENV_PORT="1"
+		;;
+	"eth1")
+		ENV_PORT="2"
+		;;
+	"eth2")
+		ENV_PORT="3"
+		;;
+	*)
+		Usage
+		exit
+		;;
+esac
+
 # Read FRU Board Custom Field 1 to get the MAC address
 for i in {1..10}; do
 	MAC_ADDR=$(read_mac_address "$BMC_FRU_BUS" "$BMC_FRU_ADDR")
@@ -81,12 +98,18 @@
 # Request to restart the service
 ifconfig "${ETHERNET_INTERFACE}" down
 fw_setenv bmc_macaddr "${MAC_ADDR}"
+
 ifconfig "${ETHERNET_INTERFACE}" hw ether "${MAC_ADDR}"
 retval=$?
 if [[ $retval -ne 0 ]]; then
 	echo "ERROR: Can not update MAC ADDR to ${ETHERNET_INTERFACE}"
 	exit 1
 fi
+# Setting LAN MAC Address to xx:xx:xx:xx:xx:xx
+ipmitool lan set "${ENV_PORT}" macaddr "${ETHERNET_INTERFACE}"
+# Enableing BMC-generated ARP responses & Setting SNMP Community String to public
+ipmitool lan set "${ENV_PORT}" arp respond on
+ipmitool lan set "${ENV_PORT}" snmp public
 ifconfig "${ETHERNET_INTERFACE}" up
 
 echo "Successfully update the MAC address ${MAC_ADDR} to ${ETHERNET_INTERFACE}"