Skip to content

Commit ea3d8af

Browse files
DavidZagurymssonicbld
authored andcommitted
[Mellanox] Use efibootmgr for supported device on fwutil (#19407)
- 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
1 parent 95ee3d9 commit ea3d8af

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

platform/mellanox/mlnx-onie-fw-update.sh

+13-4
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ enable_onie_fw_update_mode() {
6868
fi
6969

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

7579
return 0
@@ -80,7 +84,12 @@ disable_onie_fw_update_mode() {
8084
return 1
8185
fi
8286

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

8695
return 0
@@ -106,7 +115,7 @@ system_reboot() {
106115
sleep 5s
107116

108117
# Use SONiC reboot scenario
109-
/usr/local/bin/reboot
118+
/usr/local/bin/reboot -f
110119
exit $?
111120
}
112121

0 commit comments

Comments
 (0)