]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
initramfs-framework: support force reboot if fatal error occurs
authorIgor Opaniuk <igor.opaniuk@foundries.io>
Tue, 21 May 2024 13:52:45 +0000 (15:52 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 28 May 2024 08:38:20 +0000 (09:38 +0100)
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 <igor.opaniuk@foundries.io>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/initrdscripts/initramfs-framework/init

index 567694aff71c99b5942148c6a4178543a44990af..e3d8caa0e189e3c4c8a0162fe371801e393a1b48 100755 (executable)
@@ -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