initramfs-framework: support force reboot if fatal error occurs
PATCH v2 1/1 initramfs-framework: support force reboot if fatal error occurs
Add support for force reboot in the case of fatal error. In some cases it's better to force reboot (especially when hw watchdog is not engaged) instead of waiting for 3600 seconds, for example in order to trigger some recovery procedure during next boot procedure (after unsuccessful OTA update etc).
ALso fix indendation issues in the fatal() function implementation.
Signed-off-by Igor Opaniuk <[email protected]>
---
Changes in v2:
- Drop RFC tag as requested by Alexander Kanavin
.../initrdscripts/initramfs-framework/init | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework/init +13 -10
@@ -54,17 +54,20 @@ debug() { } # Prints a message and start a endless loop +# Force reboot if init_fatal_reboot bootparam is set fatal() { - echo $1 >/dev/console - echo >/dev/console - - if [ -n "$bootparam_init_fatal_sh" ]; then - sh - else - while [ "true" ]; do - sleep 3600 - done - fi + echo $1 >/dev/console + echo >/dev/console + + if [ -n "$bootparam_init_fatal_reboot" ]; then + reboot -f + elif [ -n "$bootparam_init_fatal_sh" ]; then + sh + else + while [ "true" ]; do + sleep 3600 + done + fi } # Variables shared amoung modules
Signature · 1 line
2.34.1