diff options
| author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2012-12-18 14:38:27 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-12-19 17:55:02 +0000 |
| commit | ed5d870c70671da1ce439d13819d5d3f78fb81a9 (patch) | |
| tree | 8ed831ee0da844d69f3ba940d1f9ff0924ac021f | |
| parent | ccc394e7c6d3405b87fe862e50485f548b735da3 (diff) | |
| download | poky-ed5d870c70671da1ce439d13819d5d3f78fb81a9.tar.gz | |
init-live: default to initrd shell if image isn't found
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.
(From OE-Core rev: 6f99e530822ac32f32615590e22a9758ac210e84)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-core/initrdscripts/files/init-live.sh | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh index c591f0d386..e8d7f70c2c 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() { | |||
| 45 | console_params=$arg | 45 | console_params=$arg |
| 46 | else | 46 | else |
| 47 | console_params="$console_params $arg" | 47 | console_params="$console_params $arg" |
| 48 | fi | 48 | fi ;; |
| 49 | debugshell*) | ||
| 50 | if [ -z "$optarg" ]; then | ||
| 51 | shelltimeout=30 | ||
| 52 | else | ||
| 53 | shelltimeout=$optarg | ||
| 54 | fi | ||
| 49 | esac | 55 | esac |
| 50 | done | 56 | done |
| 51 | } | 57 | } |
| @@ -75,6 +81,7 @@ early_setup | |||
| 75 | read_args | 81 | read_args |
| 76 | 82 | ||
| 77 | echo "Waiting for removable media..." | 83 | echo "Waiting for removable media..." |
| 84 | C=0 | ||
| 78 | while true | 85 | while true |
| 79 | do | 86 | do |
| 80 | for i in `ls /media 2>/dev/null`; do | 87 | for i in `ls /media 2>/dev/null`; do |
| @@ -90,6 +97,19 @@ do | |||
| 90 | if [ "$found" = "yes" ]; then | 97 | if [ "$found" = "yes" ]; then |
| 91 | break; | 98 | break; |
| 92 | fi | 99 | fi |
| 100 | # don't wait for more than $shelltimeout seconds, if it's set | ||
| 101 | if [ -n "$shelltimeout" ]; then | ||
| 102 | echo -n " " $(( $shelltimeout - $C )) | ||
| 103 | if [ $C -ge $shelltimeout ]; then | ||
| 104 | echo "..." | ||
| 105 | echo "Mounted filesystems" | ||
| 106 | mount | grep media | ||
| 107 | echo "Available block devices" | ||
| 108 | ls /dev/sd* | ||
| 109 | fatal "Cannot find rootfs.img file in /media/* , dropping to a shell " | ||
| 110 | fi | ||
| 111 | C=$(( C + 1 )) | ||
| 112 | fi | ||
| 93 | sleep 1 | 113 | sleep 1 |
| 94 | done | 114 | done |
| 95 | 115 | ||
