-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed FW upgrade sequence. #2111
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../x86_64-mlnx_msn2700-r0/platform_reboot |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../x86_64-mlnx_msn2700-r0/platform_reboot |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../x86_64-mlnx_msn2700-r0/platform_reboot |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../x86_64-mlnx_msn2700-r0/platform_reboot |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh" | ||
|
||
NEXT_SONIC_IMAGE="$(sonic_installer list | grep "Next: " | cut -d ' ' -f 2)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Check run as root? #Closed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @qiluo-msft This script is a part of reboot where we already have this check. Do we really need to duplicate it? #WontFix |
||
CURRENT_SONIC_IMAGE="$(sonic_installer list | grep "Current: " | cut -d ' ' -f 2)" | ||
|
||
FORCE_REBOOT="no" | ||
|
||
ParseArguments() { | ||
while [ $# -ge 1 ]; do | ||
case "$1" in | ||
-f|--force) | ||
FORCE_REBOOT="yes" | ||
;; | ||
esac | ||
shift | ||
done | ||
} | ||
|
||
ParseArguments $@ | ||
|
||
if [[ "${CURRENT_SONIC_IMAGE}" != "${NEXT_SONIC_IMAGE}" ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
echo "Prepare ASIC to reboot: install new FW if required" | ||
|
||
NEXT_IMAGE_FS_PATH="/host/image-${NEXT_SONIC_IMAGE#SONiC-OS-}/fs.squashfs" | ||
FS_MOUNTPOINT="/tmp/image-${NEXT_SONIC_IMAGE#SONiC-OS-}-fs" | ||
|
||
mkdir -p "${FS_MOUNTPOINT}" | ||
mount -t squashfs "${NEXT_IMAGE_FS_PATH}" "${FS_MOUNTPOINT}" | ||
|
||
${FW_UPGRADE_SCRIPT} "${FS_MOUNTPOINT}/etc/mlnx/fw-SPC.mfa" | ||
EXIT_CODE=$? | ||
|
||
umount "${FS_MOUNTPOINT}" | ||
|
||
if [[ ${EXIT_CODE} != 0 ]]; then | ||
echo "Failed to burn FW: errno=${EXIT_CODE}" | ||
|
||
if [[ ${FORCE_REBOOT} != "yes" ]]; then | ||
echo "Reboot is interrupted: use -f|--force to override" | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
/sbin/reboot $@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exec ? #Closed |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../x86_64-mlnx_msn2700-r0/platform_reboot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -e
to make it strict on any error?