sonic-buildimage/device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot
Alexander Allen 8a07af95e5
[Mellanox] Modified Platform API to support all firmware updates in single boot (#9608)
Why I did it
Requirements from Microsoft for fwutil update all state that all firmwares which support this upgrade flow must support upgrade within a single boot cycle. This conflicted with a number of Mellanox upgrade flows which have been revised to safely meet this requirement.

How I did it
Added --no-power-cycle flags to SSD and ONIE firmware scripts
Modified Platform API to call firmware upgrade flows with this new flag during fwutil update all
Added a script to our reboot plugin to handle installing firmwares in the correct order with prior to reboot
How to verify it
Populate platform_components.json with firmware for CPLD / BIOS / ONIE / SSD
Execute fwutil update all fw --boot cold
CPLD will burn / ONIE and BIOS images will stage / SSD will schedule for reboot
Reboot the switch
SSD will install / CPLD will refresh / switch will power cycle into ONIE
ONIE installer will upgrade ONIE and BIOS / switch will reboot back into SONiC
In SONiC run fwutil show status to check that all firmware upgrades were successful
2022-01-24 00:56:38 -08:00

47 lines
1014 B
Bash
Executable File

#!/bin/bash
declare -r EXIT_SUCCESS="0"
declare -r EXIT_ERROR="1"
declare -r PENDING_COMPONENT_FW="/usr/bin/install-pending-fw.py"
declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh"
declare -r SYSFS_PWR_CYCLE="/sys/devices/platform/mlxplat/mlxreg-io/hwmon/hwmon*/pwr_cycle"
FORCE_REBOOT="no"
function ParseArguments() {
while [ $# -ge 1 ]; do
case "$1" in
-f|--force)
FORCE_REBOOT="yes"
;;
esac
shift
done
}
function SafePwrCycle() {
sync ; sync
umount -fa > /dev/null 2&>1
echo 1 > $SYSFS_PWR_CYCLE
sleep 3
echo 0 > $SYSFS_PWR_CYCLE
}
ParseArguments "$@"
${FW_UPGRADE_SCRIPT} --upgrade --verbose
EXIT_CODE="$?"
if [[ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]]; then
echo "Failed to burn MLNX FW: errno=${EXIT_CODE}"
if [[ "${FORCE_REBOOT}" != "yes" ]]; then
echo "Reboot is interrupted: use -f|--force to override"
exit "${EXIT_ERROR}"
fi
fi
${PENDING_COMPONENT_FW}
SafePwrCycle