diff options
author | Scott Garman <scott.a.garman@intel.com> | 2010-11-12 16:31:13 -0800 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2010-11-14 21:08:28 -0800 |
commit | a4a896165c47bf4983bcd789820227c0f49a7272 (patch) | |
tree | ca35c264ca2f71152ec347638c21291d275390e7 | |
parent | c01e2a68dd7b51e9d6f78e0c240575f89e082c40 (diff) | |
download | openembedded-core-a4a896165c47bf4983bcd789820227c0f49a7272.tar.gz openembedded-core-a4a896165c47bf4983bcd789820227c0f49a7272.tar.bz2 openembedded-core-a4a896165c47bf4983bcd789820227c0f49a7272.zip |
poky-qemu: Fix issues when running Yocto 0.9 release images
This fixes two bugs with poky-qemu when it is run from a
standalone meta-toolchain setup.
[BUGFIX #535] and [BUGFIX #536]
Signed-off-by: Scott Garman <scott.a.garman@intel.com>
-rwxr-xr-x | scripts/poky-qemu | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/scripts/poky-qemu b/scripts/poky-qemu index 9e604b5a10..bc312e0fb6 100755 --- a/scripts/poky-qemu +++ b/scripts/poky-qemu @@ -51,6 +51,37 @@ SCRIPT_KERNEL_OPT="" TMPDIR="" +# Determine whether the file is a kernel or QEMU image, and set the +# appropriate variables +process_filename() { + filename=$1 + + # Extract the filename extension + EXT=`echo $filename | awk -F . '{ print \$NF }'` + # A file ending in .bin is a kernel + if [ "x$EXT" = "xbin" ]; then + if [ -z "$KERNEL" ]; then + KERNEL=$filename + else + echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]" + usage + fi + elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || + "x$EXT" == "xjffs2" ]]; then + # A file ending in a supportted fs type is a rootfs image + if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then + FSTYPE=$EXT + ROOTFS=$filename + else + echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]" + usage + fi + else + echo "Error: unknown file arg [$filename]" + usage + fi +} + # Parse command line args without requiring specific ordering. It's a # bit more complex, but offers a great user experience. i=1 @@ -66,7 +97,7 @@ while [ $i -le $# ]; do fi ;; "ext2" | "ext3" | "jffs2" | "nfs") - if [ -z "$FSTYPE" ]; then + if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then FSTYPE=$arg else echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" @@ -75,8 +106,8 @@ while [ $i -le $# ]; do ;; *-image-*) if [ -z "$ROOTFS" ]; then - if [ -e "$arg" ]; then - ROOTFS=$arg + if [ -f "$arg" ]; then + process_filename $arg else ROOTFS=$arg LAZY_ROOTFS="true" @@ -111,30 +142,7 @@ while [ $i -le $# ]; do usage fi elif [ -f "$arg" ]; then - # Extract the filename extension - EXT=`echo $arg | awk -F . '{ print \$NF }'` - # A file ending in .bin is a kernel - if [ "x$EXT" = "xbin" ]; then - if [ -z "$KERNEL" ]; then - KERNEL=$arg - else - echo "Error: conflicting KERNEL args [$KERNEL] and [$arg]" - usage - fi - elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || - "x$EXT" == "xjffs2" ]]; then - # A file ending in a supportted fs type is a rootfs image - if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then - FSTYPE=$EXT - ROOTFS=$arg - else - echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" - usage - fi - else - echo "Error: unknown file arg [$arg]" - usage - fi + process_filename $arg else echo "Error: unable to classify arg [$arg]" usage @@ -155,7 +163,7 @@ if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then fi if [ -z "$MACHINE" ]; then - MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'` + MACHINE=`basename $KERNEL | sed 's/.*-\(qemux86-64\|qemux86\|qemuarm\|qemumips\|qemuppc\).*/\1/'` if [ -z "$MACHINE" ]; then echo "Error: Unable to set MACHINE from kernel filename [$KERNEL]" usage |