Skip to content

Commit

Permalink
[Mellanox] Use efibootmgr for supported device on fwutil (sonic-net#1…
Browse files Browse the repository at this point in the history
…9407)

- Why I did it
Add the force flag to the reboot, which is needed now that we no longer use power cycle due to # 18325

- How I did it
Update the onie fw update script to use efibootmgr for the supported devices, and on the reboot command, call the reboot script with the f flag.

- How to verify it
Run ONIE upgrade using fwutil
  • Loading branch information
DavidZagury authored and mssonicbld committed Jul 5, 2024
1 parent 52ed2f5 commit bc3b26a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions platform/mellanox/mlnx-onie-fw-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ enable_onie_fw_update_mode() {
fi

register_terminate_handler

grub-editenv ${os_boot}/grub/grubenv set onie_entry="ONIE" || return $?
if [ -d /sys/firmware/efi/efivars ]; then
onie_boot_num=$(efibootmgr | grep "ONIE:" | awk '{ print $1 }' | cut -b 5-8 )
efibootmgr -n $onie_boot_num
else
grub-editenv ${os_boot}/grub/grubenv set onie_entry="ONIE" || return $?
fi
grub-editenv ${onie_mount}/grub/grubenv set onie_mode="update" || return $?

return 0
Expand All @@ -80,7 +84,12 @@ disable_onie_fw_update_mode() {
return 1
fi

grub-editenv ${os_boot}/grub/grubenv unset onie_entry || return $?
if [ -d /sys/firmware/efi/efivars ]; then
sonic_boot_num=$(efibootmgr | grep "SONiC-OS" | awk '{ print $1 }' | cut -b 5-8 )
efibootmgr -n $sonic_boot_num
else
grub-editenv ${os_boot}/grub/grubenv unset onie_entry || return $?
fi
grub-editenv ${onie_mount}/grub/grubenv set onie_mode="install" || return $?

return 0
Expand All @@ -106,7 +115,7 @@ system_reboot() {
sleep 5s

# Use SONiC reboot scenario
/usr/local/bin/reboot
/usr/local/bin/reboot -f
exit $?
}

Expand Down

0 comments on commit bc3b26a

Please sign in to comment.