Skip to content

Commit 118620f

Browse files
authored
[reboot] make sure the reboot happens even if platform reboot failed (#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 <[email protected]> * Rewording * add log message
1 parent 40eff82 commit 118620f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

scripts/reboot

+14-6
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,19 @@ fi
134134
if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then
135135
VERBOSE=yes debug "Rebooting with platform ${PLATFORM} specific tool ..."
136136
exec ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} $@
137-
else
138-
# If no platform-specific reboot tool, just run /sbin/reboot
139-
exec /sbin/reboot $@
137+
138+
# There are a couple reasons execution reaches here:
139+
#
140+
# 1. The vendor platform reboot returned after scheduled the platform specific reboot.
141+
# This is a vendor platform reboot code bug but it happens.
142+
# 2. The vendor platform reboot failed. e.g. due to platform driver didn't load properly.
143+
#
144+
# As result if the reboot script reaches here. We should make the reboot happen.
145+
# Sleep 1 second before calling /sbin/reboot to accommodate situation #1 above.
146+
sleep 1
147+
148+
VERBOSE=yes debug "Platform specific reboot failed!" >&2
140149
fi
141150

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

0 commit comments

Comments
 (0)