diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-21 11:35:01 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-21 11:35:01 +0000 |
commit | e121f9eb5998ea285edad902b689d16a4a2aee53 (patch) | |
tree | df0318e6a704645ce3427f7cd4a4c844c0c33e07 | |
parent | 0e2243313057d84c5d1292b83473797c5a581474 (diff) | |
download | poky-e121f9eb5998ea285edad902b689d16a4a2aee53.tar.gz |
scripts/runqemu: Factor image location code into a shell function
-rwxr-xr-x | scripts/runqemu | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index d0abe56f57..7d5107f144 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -72,17 +72,32 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o | |||
72 | CROSSPATH=$BUILDDIR/tmp/cross/arm-poky-linux-gnueabi/bin | 72 | CROSSPATH=$BUILDDIR/tmp/cross/arm-poky-linux-gnueabi/bin |
73 | fi | 73 | fi |
74 | 74 | ||
75 | function findimage { | ||
76 | where=$1 | ||
77 | machine=$2 | ||
78 | extension=$3 | ||
79 | names=$4 | ||
80 | for name in $names; | ||
81 | do | ||
82 | fullname=$where/$name-$machine.$extension | ||
83 | if [ -e "$fullname" ]; then | ||
84 | HDIMAGE=$fullname | ||
85 | return | ||
86 | fi | ||
87 | done | ||
88 | echo "Couldn't find image in $where. Attempted image names were:" | ||
89 | for name in $names; | ||
90 | do | ||
91 | echo $name-$machine.$extension | ||
92 | done | ||
93 | exit 1 | ||
94 | } | ||
95 | |||
75 | if [ "$MACHINE" = "qemuarm" ]; then | 96 | if [ "$MACHINE" = "qemuarm" ]; then |
76 | if [ "$TYPE" = "ext3" ]; then | 97 | if [ "$TYPE" = "ext3" ]; then |
77 | if [ "x$HDIMAGE" = "x" ]; then | 98 | if [ "x$HDIMAGE" = "x" ]; then |
78 | T=$BUILDDIR/tmp/deploy/images/poky-image | 99 | T=$BUILDDIR/tmp/deploy/images |
79 | if [ -e "$T-sdk-qemuarm.ext3" ]; then | 100 | findimage $T qemuarm ext3 "poky-image-sdk poky-image-sato poky-image-minimal" |
80 | HDIMAGE="$T-sdk-qemuarm.ext3" | ||
81 | elif [ -e "$T-sato-qemuarm.ext3" ]; then | ||
82 | HDIMAGE="$T-sato-qemuarm.ext3" | ||
83 | elif [ -e "$T-minimal-qemuarm.ext3" ]; then | ||
84 | HDIMAGE="$T-minimal-qemuarm.ext3" | ||
85 | fi | ||
86 | fi | 101 | fi |
87 | fi | 102 | fi |
88 | fi | 103 | fi |
@@ -118,14 +133,8 @@ if [ "$MACHINE" = "qemux86" ]; then | |||
118 | fi | 133 | fi |
119 | if [ "$TYPE" = "ext3" ]; then | 134 | if [ "$TYPE" = "ext3" ]; then |
120 | if [ "x$HDIMAGE" = "x" ]; then | 135 | if [ "x$HDIMAGE" = "x" ]; then |
121 | T=$BUILDDIR/tmp/deploy/images/poky-image | 136 | T=$BUILDDIR/tmp/deploy/images |
122 | if [ -e "$T-sdk-qemux86.ext3" ]; then | 137 | findimage $T qemux86 ext3 "poky-image-sdk poky-image-sato poky-image-minimal moblin-image-netbook" |
123 | HDIMAGE=$T-sdk-qemux86.ext3 | ||
124 | elif [ -e "$T-sato-qemux86.ext3" ]; then | ||
125 | HDIMAGE=$T-sato-qemux86.ext3 | ||
126 | elif [ -e "$T-minimal-qemux86.ext3" ]; then | ||
127 | HDIMAGE=$T-minimal-qemux86.ext3 | ||
128 | fi | ||
129 | fi | 138 | fi |
130 | fi | 139 | fi |
131 | CROSSPATH=$BUILDDIR/tmp/cross/i586-poky-linux/bin | 140 | CROSSPATH=$BUILDDIR/tmp/cross/i586-poky-linux/bin |