Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] runqemu - improve auto-detection of rootfs filenames
@ 2011-09-09  9:59 Scott Garman
  2011-09-09  9:59 ` [PATCH 1/1] runqemu: " Scott Garman
  2011-09-09 17:42 ` [PATCH 0/1] runqemu - " Richard Purdie
  0 siblings, 2 replies; 3+ messages in thread
From: Scott Garman @ 2011-09-09  9:59 UTC (permalink / raw)
  To: openembedded-core

Hello,

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].

- Scott

The following changes since commit ae4db0bacb9d40489499f77905f26502f3bcaa19:

  python-native: add link for python2 (2011-09-08 09:56:23 +0100)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib sgarman/runqemu-fixes2
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/runqemu-fixes2

Scott Garman (1):
  runqemu: improve auto-detection of rootfs filenames

 scripts/runqemu |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] runqemu: improve auto-detection of rootfs filenames
  2011-09-09  9:59 [PATCH 0/1] runqemu - improve auto-detection of rootfs filenames Scott Garman
@ 2011-09-09  9:59 ` Scott Garman
  2011-09-09 17:42 ` [PATCH 0/1] runqemu - " Richard Purdie
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Garman @ 2011-09-09  9:59 UTC (permalink / raw)
  To: openembedded-core

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].

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 scripts/runqemu |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 74938f7..8f44c0d 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -241,31 +241,24 @@ machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'`
 # Defaults used when these vars need to be inferred
 QEMUX86_DEFAULT_KERNEL=bzImage-qemux86.bin
 QEMUX86_DEFAULT_FSTYPE=ext3
-QEMUX86_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
 
 QEMUX86_64_DEFAULT_KERNEL=bzImage-qemux86-64.bin
 QEMUX86_64_DEFAULT_FSTYPE=ext3
-QEMUX86_64_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
 
 QEMUARM_DEFAULT_KERNEL=zImage-qemuarm.bin
 QEMUARM_DEFAULT_FSTYPE=ext3
-QEMUARM_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
 
 QEMUMIPS_DEFAULT_KERNEL=vmlinux-qemumips.bin
 QEMUMIPS_DEFAULT_FSTYPE=ext3
-QEMUMIPS_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
 
 QEMUPPC_DEFAULT_KERNEL=zImage-qemuppc.bin
 QEMUPPC_DEFAULT_FSTYPE=ext3
-QEMUPPC_DEFAULT_ROOTFS="core-image-sato-sdk core-image-sato core-image-lsb core-image-basic core-image-minimal"
 
 AKITA_DEFAULT_KERNEL=zImage-akita.bin
 AKITA_DEFAULT_FSTYPE=jffs2
-AKITA_DEFAULT_ROOTFS="core-image-sato"
 
 SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
 SPITZ_DEFAULT_FSTYPE=ext3
-SPITZ_DEFAULT_ROOTFS="core-image-sato"
 
 setup_tmpdir() {
     if [ -z "$TMPDIR" ]; then
@@ -302,26 +295,28 @@ setup_sysroot() {
     fi 
 }
 
-# Locate a rootfs image based on defaults defined above
+# Locate a rootfs image to boot which matches our expected
+# machine and fstype. 
 findimage() {
     where=$1
     machine=$2
     extension=$3
-    names=$4
 
-    for name in $names; do
-        fullname=$where/$name-$machine.$extension
-        if [ -e "$fullname" ]; then
-            ROOTFS=$fullname
+    # Sort rootfs candidates by modification time - the most
+    # recently created one is the one we most likely want to boot.
+    filenames=`ls -t $where/*core-image*$machine.$extension 2>/dev/null | xargs`
+    for name in $filenames; do
+        if [[ "$name" =~ core-image-sato-sdk ||
+              "$name" =~ core-image-sato     ||
+              "$name" =~ core-image-lsb      ||
+              "$name" =~ core-image-basic    ||
+              "$name" =~ core-image-minimal ]]; then
+            ROOTFS=$name
             return
-        fi
-    done
-
-    echo "Couldn't find image in $where. Attempted image names were:"
-    for name in $names; do
-        echo $name-$machine.$extension
+        fi	
     done
 
+    echo "Couldn't find a $machine rootfs image in $where."
     exit 1
 }
 
@@ -378,7 +373,7 @@ if [ -z "$ROOTFS" ]; then
     setup_tmpdir
     T=$TMPDIR/deploy/images
     eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
-    findimage $T $MACHINE $FSTYPE "$rootfs_list"
+    findimage $T $MACHINE $FSTYPE
 
     if [ -z "$ROOTFS" ]; then
         echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]"
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] runqemu - improve auto-detection of rootfs filenames
  2011-09-09  9:59 [PATCH 0/1] runqemu - improve auto-detection of rootfs filenames Scott Garman
  2011-09-09  9:59 ` [PATCH 1/1] runqemu: " Scott Garman
@ 2011-09-09 17:42 ` Richard Purdie
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2011-09-09 17:42 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Fri, 2011-09-09 at 02:59 -0700, Scott Garman wrote:
> Hello,
> 
> 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].
> 
> - Scott
> 
> The following changes since commit ae4db0bacb9d40489499f77905f26502f3bcaa19:
> 
>   python-native: add link for python2 (2011-09-08 09:56:23 +0100)
> 
> are available in the git repository at:
>   git://git.pokylinux.org/poky-contrib sgarman/runqemu-fixes2
>   http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/runqemu-fixes2
> 
> Scott Garman (1):
>   runqemu: improve auto-detection of rootfs filenames

Merged to master, thanks.

Richard




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-09 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-09  9:59 [PATCH 0/1] runqemu - improve auto-detection of rootfs filenames Scott Garman
2011-09-09  9:59 ` [PATCH 1/1] runqemu: " Scott Garman
2011-09-09 17:42 ` [PATCH 0/1] runqemu - " Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox