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

Alex DAMIAN alexandru.damian at intel.com
Mon Dec 17 11:29:13 UTC 2012


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

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

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 |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index c591f0d..2d6d6f6 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -75,6 +75,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 +91,11 @@ do
   if [ "$found" = "yes" ]; then
       break;
   fi
+  # don't wait for more than 3 seconds
+  C=$(( C + 1 ))
+  if [ $C -gt 3 ]; then
+      fatal "Cannot find root image on media"
+  fi
   sleep 1
 done
 
-- 
1.7.10.4





More information about the Openembedded-core mailing list