[OE-core] [PATCH v2] init-live: default to initrd shell if image isn't found

Alex DAMIAN alexandru.damian at intel.com
Mon Dec 17 12:55:23 UTC 2012


From: Alexandru DAMIAN <alexandru.damian at intel.com>

Adds "debugshell" command line parameter for live/install images.

If the init live fails to find and mount a root-fs image,
dumps to a shell after timeout so that the developer can figure
what's wrong.

Timeout defaults to 30 seconds, but it can be changed as param
argument.

Prior art in Ubuntu. Also, leaving a system stale isn't good form.

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index c591f0d..d99a8ea 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -45,7 +45,13 @@ read_args() {
                     console_params=$arg
                 else
                     console_params="$console_params $arg"
-                fi
+                fi ;;
+            debugshell*)
+                if [ -z "$optarg" ]; then
+                        shelltimeout=30
+                else
+                        shelltimeout=$optarg
+                fi 
         esac
     done
 }
@@ -75,6 +81,7 @@ early_setup
 read_args
 
 echo "Waiting for removable media..."
+C=0
 while true
 do
   for i in `ls /media 2>/dev/null`; do
@@ -90,6 +97,15 @@ do
   if [ "$found" = "yes" ]; then
       break;
   fi
+  # don't wait for more than $shelltimeout seconds, if it's set
+  if [ -n "$shelltimeout" ]; then
+      echo -n " " $(( $shelltimeout - $C ))
+      if [ $C -ge $shelltimeout ]; then
+           echo "..."
+           fatal "Cannot find root image on media, dropping to shell "
+      fi
+      C=$(( C + 1 ))
+  fi
   sleep 1
 done
 
-- 
1.7.10.4





More information about the Openembedded-core mailing list