diff options
author | Scott Garman <scott.a.garman@intel.com> | 2011-09-09 02:59:27 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-09-09 18:42:05 +0100 |
commit | 9c740e042500545b09b1079be4978498d7c32a0f (patch) | |
tree | ce834163471bc04da15cb9049af6a58ed046f4a1 /scripts/runqemu | |
parent | c505815742328a5bfe4bd3d3eff5e671c1be222c (diff) | |
download | poky-9c740e042500545b09b1079be4978498d7c32a0f.tar.gz |
runqemu: improve auto-detection of rootfs filenames
This refactors the way rootfs filenames are auto-detected when you
run the runqemu script without an explicit rootfs filename argument.
It allows the script to use rootfs files generated by hob, and when
there are mutliple rootfs files to choose from, it will pick the
most recently created one.
Fixes [YOCTO #1437].
(From OE-Core rev: 094453f443ed592d814dfb4182a0a02f0a2552e4)
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-x | scripts/runqemu | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 364fa1cb14..0f943b5fec 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -239,31 +239,24 @@ machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` | |||
239 | # Defaults used when these vars need to be inferred | 239 | # Defaults used when these vars need to be inferred |
240 | QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin | 240 | QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin |
241 | QEMUX86_DEFAULT_FSTYPE=ext3 | 241 | QEMUX86_DEFAULT_FSTYPE=ext3 |
242 | QEMUX86_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal" | ||
243 | 242 | ||
244 | QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin | 243 | QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin |
245 | QEMUX86_64_DEFAULT_FSTYPE=ext3 | 244 | QEMUX86_64_DEFAULT_FSTYPE=ext3 |
246 | QEMUX86_64_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal" | ||
247 | 245 | ||
248 | QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin | 246 | QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin |
249 | QEMUARM_DEFAULT_FSTYPE=ext3 | 247 | QEMUARM_DEFAULT_FSTYPE=ext3 |
250 | QEMUARM_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal" | ||
251 | 248 | ||
252 | QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin | 249 | QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin |
253 | QEMUMIPS_DEFAULT_FSTYPE=ext3 | 250 | QEMUMIPS_DEFAULT_FSTYPE=ext3 |
254 | QEMUMIPS_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal" | ||
255 | 251 | ||
256 | QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin | 252 | QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin |
257 | QEMUPPC_DEFAULT_FSTYPE=ext3 | 253 | QEMUPPC_DEFAULT_FSTYPE=ext3 |
258 | QEMUPPC_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal" | ||
259 | 254 | ||
260 | AKITA_DEFAULT_KERNEL=zImage-akita.bin | 255 | AKITA_DEFAULT_KERNEL=zImage-akita.bin |
261 | AKITA_DEFAULT_FSTYPE=jffs2 | 256 | AKITA_DEFAULT_FSTYPE=jffs2 |
262 | AKITA_DEFAULT_ROOTFS="core-image-sato" | ||
263 | 257 | ||
264 | SPITZ_DEFAULT_KERNEL=zImage-spitz.bin | 258 | SPITZ_DEFAULT_KERNEL=zImage-spitz.bin |
265 | SPITZ_DEFAULT_FSTYPE=ext3 | 259 | SPITZ_DEFAULT_FSTYPE=ext3 |
266 | SPITZ_DEFAULT_ROOTFS="core-image-sato" | ||
267 | 260 | ||
268 | setup_tmpdir() { | 261 | setup_tmpdir() { |
269 | if [ -z "$TMPDIR" ]; then | 262 | if [ -z "$TMPDIR" ]; then |
@@ -300,26 +293,28 @@ setup_sysroot() { | |||
300 | fi | 293 | fi |
301 | } | 294 | } |
302 | 295 | ||
303 | # Locate a rootfs image based on defaults defined above | 296 | # Locate a rootfs image to boot which matches our expected |
297 | # machine and fstype. | ||
304 | findimage() { | 298 | findimage() { |
305 | where=$1 | 299 | where=$1 |
306 | machine=$2 | 300 | machine=$2 |
307 | extension=$3 | 301 | extension=$3 |
308 | names=$4 | ||
309 | 302 | ||
310 | for name in $names; do | 303 | # Sort rootfs candidates by modification time - the most |
311 | fullname=$where/$name-$machine.$extension | 304 | # recently created one is the one we most likely want to boot. |
312 | if [ -e "$fullname" ]; then | 305 | filenames=`ls -t $where/*core-image*$machine.$extension 2>/dev/null | xargs` |
313 | ROOTFS=$fullname | 306 | for name in $filenames; do |
307 | if [[ "$name" =~ core-image-sato-sdk || | ||
308 | "$name" =~ core-image-sato || | ||
309 | "$name" =~ core-image-lsb || | ||
310 | "$name" =~ core-image-basic || | ||
311 | "$name" =~ core-image-minimal ]]; then | ||
312 | ROOTFS=$name | ||
314 | return | 313 | return |
315 | fi | 314 | fi |
316 | done | ||
317 | |||
318 | echo "Couldn't find image in $where. Attempted image names were:" | ||
319 | for name in $names; do | ||
320 | echo $name-$machine.$extension | ||
321 | done | 315 | done |
322 | 316 | ||
317 | echo "Couldn't find a $machine rootfs image in $where." | ||
323 | exit 1 | 318 | exit 1 |
324 | } | 319 | } |
325 | 320 | ||
@@ -376,7 +371,7 @@ if [ -z "$ROOTFS" ]; then | |||
376 | setup_tmpdir | 371 | setup_tmpdir |
377 | T=$TMPDIR/deploy/images | 372 | T=$TMPDIR/deploy/images |
378 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS | 373 | eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS |
379 | findimage $T $MACHINE $FSTYPE "$rootfs_list" | 374 | findimage $T $MACHINE $FSTYPE |
380 | 375 | ||
381 | if [ -z "$ROOTFS" ]; then | 376 | if [ -z "$ROOTFS" ]; then |
382 | echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]" | 377 | echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]" |