All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] poky-qemu fixes for Laverne point-release
@ 2011-01-13 18:58 Scott Garman
  2011-01-13 18:58 ` [PATCH 2/3] Make poky-qemu and related scripts work with arbitrary SDK locations Scott Garman
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Scott Garman @ 2011-01-13 18:58 UTC (permalink / raw)
  To: poky

Hi Josh,

This pull request includes important poky-qemu fixes that I'd like to
see included for our upcoming Laverne point-release.

Pull URL: git://git.pokylinux.org/poky-contrib.git
  Branch: sgarman/laverne-point-release
  Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/laverne-point-release

Thanks,
    Scott Garman <scott.a.garman@intel.com>
---


Richard Purdie (1):
  scripts/poky-qemu: Improve tmp layout assumption

Scott Garman (2):
  poky-qemu: Fix issues when running Yocto 0.9 release images
  Make poky-qemu and related scripts work with arbitrary SDK locations

 scripts/poky-find-native-sysroot |    2 +-
 scripts/poky-qemu                |  104 +++++++++++++++++++++----------------
 scripts/poky-qemu-ifdown         |    9 +---
 scripts/poky-qemu-ifup           |    9 +---
 scripts/poky-qemu-internal       |   16 +------
 5 files changed, 63 insertions(+), 77 deletions(-)

-- 
1.7.3.4



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

* [PATCH 1/3] poky-qemu: Fix issues when running Yocto 0.9 release images
  2011-01-13 18:58 [PATCH 0/3] poky-qemu fixes for Laverne point-release Scott Garman
  2011-01-13 18:58 ` [PATCH 2/3] Make poky-qemu and related scripts work with arbitrary SDK locations Scott Garman
  2011-01-13 18:58 ` [PATCH 3/3] scripts/poky-qemu: Improve tmp layout assumption Richard Purdie
@ 2011-01-13 18:58 ` Scott Garman
  2011-01-14 12:26 ` [PATCH 0/3] poky-qemu fixes for Laverne point-release Joshua Lock
  3 siblings, 0 replies; 5+ messages in thread
From: Scott Garman @ 2011-01-13 18:58 UTC (permalink / raw)
  To: poky

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>
---
 scripts/poky-qemu |   64 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index 9e604b5..bc312e0 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
-- 
1.7.3.4



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

* [PATCH 3/3] scripts/poky-qemu: Improve tmp layout assumption
  2011-01-13 18:58 [PATCH 0/3] poky-qemu fixes for Laverne point-release Scott Garman
  2011-01-13 18:58 ` [PATCH 2/3] Make poky-qemu and related scripts work with arbitrary SDK locations Scott Garman
@ 2011-01-13 18:58 ` Richard Purdie
  2011-01-13 18:58 ` [PATCH 1/3] poky-qemu: Fix issues when running Yocto 0.9 release images Scott Garman
  2011-01-14 12:26 ` [PATCH 0/3] poky-qemu fixes for Laverne point-release Joshua Lock
  3 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2011-01-13 18:58 UTC (permalink / raw)
  To: poky

If someone has changed TMPDIR in local.conf to a non-standard location, the
poky-qemu script currently doesn't handle this and assumes if BUILDDIR is set,
$BUILDDIR/tmp will exist.

Its simple to check if this exists and if not, to ask bitbake where the
directory is so this patch changes the code to do that.

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
---
 scripts/poky-qemu |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index 67af439..19305e2 100755
--- a/scripts/poky-qemu
+++ b/scripts/poky-qemu
@@ -204,7 +204,7 @@ SPITZ_DEFAULT_ROOTFS="poky-image-sato"
 
 setup_tmpdir() {
     if [ -z "$TMPDIR" ]; then
-        if [ "x$BUILDDIR" = "x" ]; then
+        if [ "x$BUILDDIR" = "x" -o ! -d "$BUILDDIR/tmp" ]; then
             # BUILDDIR unset, try and get TMPDIR from bitbake
             type -P bitbake &>/dev/null || {
                 echo "In order for this script to dynamically infer paths";
-- 
1.7.3.4



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

* [PATCH 2/3] Make poky-qemu and related scripts work with arbitrary SDK locations
  2011-01-13 18:58 [PATCH 0/3] poky-qemu fixes for Laverne point-release Scott Garman
@ 2011-01-13 18:58 ` Scott Garman
  2011-01-13 18:58 ` [PATCH 3/3] scripts/poky-qemu: Improve tmp layout assumption Richard Purdie
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Scott Garman @ 2011-01-13 18:58 UTC (permalink / raw)
  To: poky

* No longer assume SDK toolchains are installed in /opt/poky
* [BUGFIX #568] where specifying paths to both the kernel and fs
  image caused an error due to POKY_NATIVE_SYSROOT never being
  set, triggering failure of poky-qemu-ifup/ifdown
* Cosmetic improvements to usage() functions by using basename

Signed-off-by: Scott Garman <scott.a.garman@intel.com>
---
 scripts/poky-find-native-sysroot |    2 +-
 scripts/poky-qemu                |   38 ++++++++++++++++++++++----------------
 scripts/poky-qemu-ifdown         |    9 +--------
 scripts/poky-qemu-ifup           |    9 +--------
 scripts/poky-qemu-internal       |   16 +---------------
 5 files changed, 26 insertions(+), 48 deletions(-)

diff --git a/scripts/poky-find-native-sysroot b/scripts/poky-find-native-sysroot
index d8002f9..2262294 100755
--- a/scripts/poky-find-native-sysroot
+++ b/scripts/poky-find-native-sysroot
@@ -1,7 +1,7 @@
 #!/bin/bash
 #
 # Find a native sysroot to use - either from an in-tree Poky build or
-# from a toolchain installation in /opt/poky. It then ensures the variable
+# from a toolchain installation. It then ensures the variable
 # $POKY_NATIVE_SYSROOT is set to the sysroot's base directory, and sets 
 # $PSEUDO to the path of the pseudo binary.
 #
diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index bc312e0..67af439 100755
--- a/scripts/poky-qemu
+++ b/scripts/poky-qemu
@@ -31,9 +31,9 @@ usage() {
     echo "    serial - enables a serial console on /dev/ttyS0"
     echo ""
     echo "Examples:"
-    echo "  $0 qemuarm"
-    echo "  $0 qemux86-64 poky-image-sato ext3"
-    echo "  $0 path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
+    echo "  $MYNAME qemuarm"
+    echo "  $MYNAME qemux86-64 poky-image-sato ext3"
+    echo "  $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
     exit 1
 }
 
@@ -213,23 +213,29 @@ setup_tmpdir() {
                 echo "before running this script" >&2;
                 exit 1; }
 
-            # We have bitbake in PATH, get TMPDIR and BUILD_SYS
-            # from the environment
+            # We have bitbake in PATH, get TMPDIR from bitbake
             TMPDIR=`bitbake -e | grep TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
-            BUILD_SYS=`bitbake -e | grep BUILD_SYS=\" | cut -d '=' -f2 | cut -d '"' -f2`
         else
-            BUILD_ARCH=`uname -m`
-            BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
-            BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
             TMPDIR=$BUILDDIR/tmp
         fi
-        if [ -z "$POKY_NATIVE_SYSROOT" ]; then
-            POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
-        fi
-        CROSSPATH=$POKY_NATIVE_SYSROOT/usr/bin
     fi
 }
 
+setup_sysroot() {
+	# Toolchain installs set up $POKY_NATIVE_SYSROOT in their
+	# environment script. If that variable isn't set, we're
+	# either in an in-tree poky scenario or the environment
+	# script wasn't source'd.
+	if [ -z "$POKY_NATIVE_SYSROOT" ]; then
+		setup_tmpdir
+		BUILD_ARCH=`uname -m`
+		BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
+		BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
+
+		POKY_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
+	fi 
+}
+
 # Locate a rootfs image based on defaults defined above
 findimage() {
     where=$1
@@ -254,8 +260,6 @@ findimage() {
 }
 
 if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
-    setup_tmpdir
-
     # Extract the filename extension
     EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
     if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || 
@@ -281,7 +285,6 @@ fi
 # KERNEL is now set for all cases
 
 if [ -z "$FSTYPE" ]; then
-    setup_tmpdir
     eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
 
     if [ -z "$FSTYPE" ]; then
@@ -318,6 +321,9 @@ echo "KERNEL: [$KERNEL]"
 echo "ROOTFS: [$ROOTFS]"
 echo "FSTYPE: [$FSTYPE]"
 
+setup_sysroot
+# POKY_NATIVE_SYSROOT is now set for all cases
+
 # We can't run without a libGL.so
 libgl='no'
 
diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown
index 60ca919..bc90a9c 100755
--- a/scripts/poky-qemu-ifdown
+++ b/scripts/poky-qemu-ifdown
@@ -27,7 +27,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 usage() {
-	echo "sudo $0 <tap-dev> <native-sysroot-basedir>"
+	echo "sudo $(basename $0) <tap-dev> <native-sysroot-basedir>"
 }
 
 if [ $EUID -ne 0 ]; then
@@ -46,13 +46,6 @@ NATIVE_SYSROOT_DIR=$2
 TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
 if [ ! -e "$TUNCTL" ]; then
 	echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'"
-
-	if [[ "$NATIVE_SYSROOT_DIR" =~ ^\/opt\/poky ]]; then
-		echo "This shouldn't happen - something is wrong with your toolchain installation"
-	else
-		echo "Have you run 'bitbake meta-ide-support'?"
-	fi
-
 	exit 1
 fi
 
diff --git a/scripts/poky-qemu-ifup b/scripts/poky-qemu-ifup
index 8685c83..f82848c 100755
--- a/scripts/poky-qemu-ifup
+++ b/scripts/poky-qemu-ifup
@@ -34,7 +34,7 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 usage() {
-	echo "sudo $0 <gid> <native-sysroot-basedir>"
+	echo "sudo $(basename $0) <gid> <native-sysroot-basedir>"
 }
 
 if [ $EUID -ne 0 ]; then
@@ -53,13 +53,6 @@ NATIVE_SYSROOT_DIR=$2
 TUNCTL=$NATIVE_SYSROOT_DIR/usr/bin/tunctl
 if [ ! -x "$TUNCTL" ]; then
 	echo "Error: Unable to find tunctl binary in '$NATIVE_SYSROOT_DIR/usr/bin'"
-
-	if [[ "$NATIVE_SYSROOT_DIR" =~ ^\/opt\/poky ]]; then
-		echo "This shouldn't happen - something is wrong with your toolchain installation"
-	else
-		echo "Have you run 'bitbake meta-ide-support'?"
-	fi
-	
 	exit 1
 fi
 
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
index cf16407..c38d530 100755
--- a/scripts/poky-qemu-internal
+++ b/scripts/poky-qemu-internal
@@ -394,23 +394,9 @@ if [ "x$QEMUOPTIONS" = "x" ]; then
     return
 fi
 
-SDKDIR="/opt/poky/sysroots"
-if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "spitz" -o "$MACHINE" = "borzoi" -o "$MACHINE" = "akita" -o "$MACHINE" = "nokia800" ]; then
-    SDKPATH="$SDKDIR/arm-poky-linux-gnueabi/bin"
-fi
-
-if [ "$MACHINE" = "qemux86" ]; then
-    SDKPATH="$SDKDIR/i586-poky-linux/bin"
-fi
-
-if [ "$MACHINE" = "qemux86-64" ]; then
-    SDKPATH="$SDKDIR/x86_64-poky-linux/bin"
-fi
-
-PATH=$CROSSPATH:$SDKPATH:$PATH
+PATH=$CROSSPATH:$POKY_NATIVE_SYSROOT/usr/bin:$PATH
 
 QEMUBIN=`which $QEMU`
-
 if [ ! -x "$QEMUBIN" ]; then
     echo "Error: No QEMU binary '$QEMU' could be found."
     cleanup
-- 
1.7.3.4



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

* Re: [PATCH 0/3] poky-qemu fixes for Laverne point-release
  2011-01-13 18:58 [PATCH 0/3] poky-qemu fixes for Laverne point-release Scott Garman
                   ` (2 preceding siblings ...)
  2011-01-13 18:58 ` [PATCH 1/3] poky-qemu: Fix issues when running Yocto 0.9 release images Scott Garman
@ 2011-01-14 12:26 ` Joshua Lock
  3 siblings, 0 replies; 5+ messages in thread
From: Joshua Lock @ 2011-01-14 12:26 UTC (permalink / raw)
  To: poky

On Thu, 2011-01-13 at 10:58 -0800, Scott Garman wrote:
> Hi Josh,
> 
> This pull request includes important poky-qemu fixes that I'd like to
> see included for our upcoming Laverne point-release.

Thanks Scott, I've included these in my josh/laverne branch on
poky-contrib.

Regards,
Joshua

> 
> Pull URL: git://git.pokylinux.org/poky-contrib.git
>   Branch: sgarman/laverne-point-release
>   Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=sgarman/laverne-point-release
> 
> Thanks,
>     Scott Garman <scott.a.garman@intel.com>
> ---
> 
> 
> Richard Purdie (1):
>   scripts/poky-qemu: Improve tmp layout assumption
> 
> Scott Garman (2):
>   poky-qemu: Fix issues when running Yocto 0.9 release images
>   Make poky-qemu and related scripts work with arbitrary SDK locations
> 
>  scripts/poky-find-native-sysroot |    2 +-
>  scripts/poky-qemu                |  104 +++++++++++++++++++++----------------
>  scripts/poky-qemu-ifdown         |    9 +---
>  scripts/poky-qemu-ifup           |    9 +---
>  scripts/poky-qemu-internal       |   16 +------
>  5 files changed, 63 insertions(+), 77 deletions(-)
> 

-- 
Joshua Lock
        Intel Open Source Technology Centre



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

end of thread, other threads:[~2011-01-14 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 18:58 [PATCH 0/3] poky-qemu fixes for Laverne point-release Scott Garman
2011-01-13 18:58 ` [PATCH 2/3] Make poky-qemu and related scripts work with arbitrary SDK locations Scott Garman
2011-01-13 18:58 ` [PATCH 3/3] scripts/poky-qemu: Improve tmp layout assumption Richard Purdie
2011-01-13 18:58 ` [PATCH 1/3] poky-qemu: Fix issues when running Yocto 0.9 release images Scott Garman
2011-01-14 12:26 ` [PATCH 0/3] poky-qemu fixes for Laverne point-release Joshua Lock

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.