Skip to content

Commit

Permalink
[reboot] make sure the reboot happens even if platform reboot failed (s…
Browse files Browse the repository at this point in the history
…onic-net#819)

* [reboot] make sure the reboot happens even if platform reboot failed

Platform reboot tool could fail if the platform driver didn't load
properly. In this case, a reboot is required to recover the device.
We need to make sure the reboot tool is robust.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>

* Rewording

* add log message
  • Loading branch information
yxieca authored Feb 23, 2020
1 parent 40eff82 commit 118620f
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,19 @@ fi
if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then
VERBOSE=yes debug "Rebooting with platform ${PLATFORM} specific tool ..."
exec ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} $@
else
# If no platform-specific reboot tool, just run /sbin/reboot
exec /sbin/reboot $@

# There are a couple reasons execution reaches here:
#
# 1. The vendor platform reboot returned after scheduled the platform specific reboot.
# This is a vendor platform reboot code bug but it happens.
# 2. The vendor platform reboot failed. e.g. due to platform driver didn't load properly.
#
# As result if the reboot script reaches here. We should make the reboot happen.
# Sleep 1 second before calling /sbin/reboot to accommodate situation #1 above.
sleep 1

VERBOSE=yes debug "Platform specific reboot failed!" >&2
fi

# Should never reach here
VERBOSE=yes debug "Reboot failed!" >&2
exit 1
VERBOSE=yes debug "Issuing OS-level reboot ..." >&2
exec /sbin/reboot $@

0 comments on commit 118620f

Please sign in to comment.