meta-ampere: mtjade: set MAC Address from FruDevice
FruDevice service is always running no matter if entity-manager is used
or not. It scans for all FRU EEPROMs, parse and store information into
dbus.
This commit changes to get BMC MAC Address from FruDevice data instead
of ipmi-fru-parser.
Tested:
1. Clear environment in u-boot, boot BMC to Linux and check if the
eth1addr variable is set with value from FRU.
2. Change BMC MAC address from FRU's Board Extra. Reboot BMC and check
if the eth1addr variable is set with new BMC MAC Address
Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: I99b5d46c8a22b98402f749cdebd1c0aad3d6daf0
diff --git a/meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update.bb b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update.bb
similarity index 100%
rename from meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update.bb
rename to meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update.bb
diff --git a/meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update/ampere_update_mac.service b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service
similarity index 100%
rename from meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update/ampere_update_mac.service
rename to meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.service
diff --git a/meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update/ampere_update_mac.sh b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.sh
similarity index 71%
rename from meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update/ampere_update_mac.sh
rename to meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.sh
index 5dbdde7..4e4d6f3 100644
--- a/meta-ampere/meta-common/recipes-ac01/mac/ampere-mac-update/ampere_update_mac.sh
+++ b/meta-ampere/meta-jade/recipes-ampere/platform/ampere-mac-update/ampere_update_mac.sh
@@ -2,18 +2,17 @@
#
# This script is used to get the MAC Address from FRU Inventory information
-ETHERNET_INTERFACE="eth0"
+ETHERNET_INTERFACE="eth1"
+ETHERNET_NCSI="eth0"
ENV_ETH="eth1addr"
-ENV_MAC_ADDR=`fw_printenv`
+ENV_MAC_ADDR=`fw_printenv | grep $ENV_ETH`
-# Check if BMC MAC address is exported
-if [[ $ENV_MAC_ADDR =~ $ENV_ETH ]]; then
- echo "WARNING: BMC MAC address already exist!"
- exit 0
-fi
+# Workaround to dhcp NC-SI eth0 interface when BMC boot up
+ifconfig ${ETHERNET_NCSI} down
+ifconfig ${ETHERNET_NCSI} up
# Read FRU Board Custom Field 1 to get the MAC address
-CUSTOM_FIELD_1=`busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard xyz.openbmc_project.Inventory.Item.NetworkInterface MACAddress`
+CUSTOM_FIELD_1=`busctl get-property xyz.openbmc_project.FruDevice /xyz/openbmc_project/FruDevice/Mt_Jade_Motherboard xyz.openbmc_project.FruDevice BOARD_INFO_AM1`
MAC_ADDR=`echo $CUSTOM_FIELD_1 | cut -d "\"" -f 2`
# Check if BMC MAC address is exported
@@ -23,6 +22,12 @@
exit 1
fi
+# Check if BMC MAC address is exported
+if [[ $ENV_MAC_ADDR =~ $MAC_ADDR ]]; then
+ echo "WARNING: BMC MAC address already exist!"
+ exit 0
+fi
+
# Request to update the MAC address
fw_setenv ${ENV_ETH} ${MAC_ADDR}