From: Igor Opaniuk Date: Tue, 21 May 2024 13:52:45 +0000 (+0200) Subject: initramfs-framework: support force reboot if fatal error occurs X-Git-Tag: uninative-4.6~454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6990855e91f2d5891e95995f3f4a1c3b5891c619;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git 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 Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/init b/meta/recipes-core/initrdscripts/initramfs-framework/init index 567694aff71..e3d8caa0e18 100755 --- a/meta/recipes-core/initrdscripts/initramfs-framework/init +++ b/meta/recipes-core/initrdscripts/initramfs-framework/init @@ -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