Blob Blame History Raw
commit 081e7ac9675b49346e937236f38822b33c8c751b
Author: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Date:   Sun Jan 21 21:10:07 2018 +0530

    update_flash: Use inband ipmi path to get firmware version
    
    update_flash_nv uses 'ipmitool -I usb' interface to get firmware version
    details. This is AMI BMC OEM feature and not available on other BMC systems.
    Hence lets use inband interface to get firmware version details.
    
    Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
    Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

diff --git a/scripts/update_flash_nv b/scripts/update_flash_nv
index 0cec2eb..0ef765c 100755
--- a/scripts/update_flash_nv
+++ b/scripts/update_flash_nv
@@ -588,16 +588,27 @@ opp_manage_flash() {
 }
 
 opp_display_current_fw_version() {
-	check_ipmitool
+	which ipmitool >/dev/null 2>&1
+	if [ $? -ne 0 ]; then
+		echo "update_flash: ipmitool command not found."
+		error $E_IPMI "Please install ipmitool and retry."
+	fi
+
+	# Use inband interface to get firmware version
+	ipmitool mc info >/dev/null 2>&1 && break;
+	if [ $? -ne 0 ]; then
+		echo "update_flash: ipmi inband interface is not working."
+		error $E_IPMI "Check 'ipmi_devintf' kernel module loaded or not."
+	fi
 
 	echo
-	id=`ipmitool -I usb fru 2>/dev/null |grep "System Firmware" | cut -d " " -f8 | cut -d ")" -f1`
+	id=`ipmitool fru 2>/dev/null |grep "System Firmware" | cut -d " " -f8 | cut -d ")" -f1`
 	if [ "x$id" = "x" ]; then
 		error $E_IPMI "Failed to get firmware version."
 	fi
 
 	echo "Firmware version:"
-	ipmitool -I usb fru print $id
+	ipmitool fru print $id
 
 	exit $E_SUCCESS
 }