From 37e6a990daec5ccc361c91b7ad58de970f728142 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sun, 23 Feb 2020 02:11:39 +0000 Subject: [PATCH 1/3] [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 --- scripts/reboot | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/scripts/reboot b/scripts/reboot index 131aba24ec..41e61d132e 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -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 "Reboot failed!" >&2 fi -# Should never reach here -VERBOSE=yes debug "Reboot failed!" >&2 -exit 1 +exec /sbin/reboot $@ + From 63a5ba3ac85158d4b974494eba7076c041ae5c44 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sun, 23 Feb 2020 05:30:50 +0000 Subject: [PATCH 2/3] Rewording --- scripts/reboot | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/reboot b/scripts/reboot index 41e61d132e..eae875760f 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -145,8 +145,7 @@ if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then # Sleep 1 second before calling /sbin/reboot to accommodate situation #1 above. sleep 1 - VERBOSE=yes debug "Reboot failed!" >&2 + VERBOSE=yes debug "Platform specific reboot failed! Issuing OS-level reboot ..." >&2 fi exec /sbin/reboot $@ - From df3a360056f7f9dbae57d7c39b48be6f3e06a3e3 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Sun, 23 Feb 2020 18:55:55 +0000 Subject: [PATCH 3/3] add log message --- scripts/reboot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/reboot b/scripts/reboot index eae875760f..15c936bc00 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -145,7 +145,8 @@ if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then # Sleep 1 second before calling /sbin/reboot to accommodate situation #1 above. sleep 1 - VERBOSE=yes debug "Platform specific reboot failed! Issuing OS-level reboot ..." >&2 + VERBOSE=yes debug "Platform specific reboot failed!" >&2 fi +VERBOSE=yes debug "Issuing OS-level reboot ..." >&2 exec /sbin/reboot $@