init: handle non-existing bootmode init file 16/178416/2
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 10 May 2018 03:59:41 +0000 (12:59 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 17 May 2018 00:49:22 +0000 (00:49 +0000)
If there is no bootmode init file, init fails to execute the file
and pid 1 exit with error causes kernel panic. Handle non-existing
bootmode file by rebooting.

Change-Id: I7b233a7ae57a8be98693cf02b52315cf1bca3bde
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
src/initrd-recovery/init

index 0bac889723f24c4c7f1d3fa4dbecd7c3c57335bf..7c6cf17452f9a6cd81d681ef883e6bbc8d2f0e61 100755 (executable)
@@ -85,4 +85,11 @@ if [ "z$BOOT_MODE" = "z" ]; then
     do_reboot
 fi
 echo "BOOTMODE is ${BOOT_MODE}"
-exec "/sbin/${BOOT_MODE}-init"
+
+if [ -f /sbin/${BOOT_MODE}-init ]; then
+    exec "/sbin/${BOOT_MODE}-init"
+else
+    echo "no ${BOOT_MODE}-init!!"
+    echo "Do reboot!!"
+    do_reboot
+fi