summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2011-09-09 02:59:27 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-09-09 18:42:05 +0100
commit9c740e042500545b09b1079be4978498d7c32a0f (patch)
treece834163471bc04da15cb9049af6a58ed046f4a1 /scripts
parentc505815742328a5bfe4bd3d3eff5e671c1be222c (diff)
downloadpoky-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')
-rwxr-xr-xscripts/runqemu35
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
240QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin 240QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
241QEMUX86_DEFAULT_FSTYPE=ext3 241QEMUX86_DEFAULT_FSTYPE=ext3
242QEMUX86_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
243 242
244QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin 243QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
245QEMUX86_64_DEFAULT_FSTYPE=ext3 244QEMUX86_64_DEFAULT_FSTYPE=ext3
246QEMUX86_64_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
247 245
248QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin 246QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
249QEMUARM_DEFAULT_FSTYPE=ext3 247QEMUARM_DEFAULT_FSTYPE=ext3
250QEMUARM_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
251 248
252QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin 249QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
253QEMUMIPS_DEFAULT_FSTYPE=ext3 250QEMUMIPS_DEFAULT_FSTYPE=ext3
254QEMUMIPS_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
255 251
256QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin 252QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin
257QEMUPPC_DEFAULT_FSTYPE=ext3 253QEMUPPC_DEFAULT_FSTYPE=ext3
258QEMUPPC_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
259 254
260AKITA_DEFAULT_KERNEL=zImage-akita.bin 255AKITA_DEFAULT_KERNEL=zImage-akita.bin
261AKITA_DEFAULT_FSTYPE=jffs2 256AKITA_DEFAULT_FSTYPE=jffs2
262AKITA_DEFAULT_ROOTFS="core-image-sato"
263 257
264SPITZ_DEFAULT_KERNEL=zImage-spitz.bin 258SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
265SPITZ_DEFAULT_FSTYPE=ext3 259SPITZ_DEFAULT_FSTYPE=ext3
266SPITZ_DEFAULT_ROOTFS="core-image-sato"
267 260
268setup_tmpdir() { 261setup_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.
304findimage() { 298findimage() {
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]"