Openembedded Devel Discussions
 help / color / mirror / Atom feed
* [PATCH 1/5] runqemu: Use OE_TMPDIR
@ 2012-04-27 14:26 Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 2/5] runqemu: use modern, single-char name of test(1) Bernhard Reutner-Fischer
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-27 14:26 UTC (permalink / raw)
  To: openembedded-devel

The error message erroneously talked about TMPDIR.
Just use OE_TMPDIR everywhere to make the name of the variable obvious.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 scripts/runqemu |   27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index caabf61..7c2c4b3 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -55,11 +55,6 @@ SCRIPT_QEMU_OPT=""
 SCRIPT_QEMU_EXTRA_OPT=""
 SCRIPT_KERNEL_OPT=""
 
-# Don't use TMPDIR from the external environment, it may be a distro
-# variable pointing to /tmp (e.g. within X on OpenSUSE)
-# Instead, use OE_TMPDIR for passing this in externally.
-TMPDIR="$OE_TMPDIR"
-
 # Determine whether the file is a kernel or QEMU image, and set the
 # appropriate variables
 process_filename() {
@@ -273,8 +268,8 @@ SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
 SPITZ_DEFAULT_FSTYPE=ext3
 
 setup_tmpdir() {
-    if [ -z "$TMPDIR" ]; then
-        # Try to get TMPDIR from bitbake
+    if [ -z "$OE_TMPDIR" ]; then
+        # Try to get OE_TMPDIR from bitbake
         type -P bitbake &>/dev/null || {
             echo "In order for this script to dynamically infer paths";
             echo "to kernels or filesystem images, you either need";
@@ -282,11 +277,11 @@ setup_tmpdir() {
             echo "before running this script" >&2;
             exit 1; }
 
-        # We have bitbake in PATH, get TMPDIR from bitbake
-        TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
-        if [ -z "$TMPDIR" ]; then
+        # We have bitbake in PATH, get OE_TMPDIR from bitbake
+        OE_TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
+        if [ -z "$OE_TMPDIR" ]; then
             echo "Error: this script needs to be run from your build directory,"
-            echo "or you need to explicitly set TMPDIR in your environment"
+            echo "or you need to explicitly set OE_TMPDIR in your environment"
             exit 1
         fi
     fi
@@ -303,7 +298,7 @@ setup_sysroot() {
         BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
         BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
 
-        OECORE_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
+        OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
     fi 
 }
 
@@ -348,7 +343,7 @@ fi
 if [ -z "$KERNEL" ]; then
     setup_tmpdir
     eval kernel_file=\$${machine2}_DEFAULT_KERNEL
-    KERNEL=$TMPDIR/deploy/images/$kernel_file
+    KERNEL=$OE_TMPDIR/deploy/images/$kernel_file
 
     if [ -z "$KERNEL" ]; then
         echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]"
@@ -372,13 +367,13 @@ fi
 # core-image-sato
 if [ "$LAZY_ROOTFS" = "true" ]; then
     setup_tmpdir
-    echo "Assuming $ROOTFS really means $TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
-    ROOTFS=$TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
+    echo "Assuming $ROOTFS really means $OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
+    ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
 fi
 
 if [ -z "$ROOTFS" ]; then
     setup_tmpdir
-    T=$TMPDIR/deploy/images
+    T=$OE_TMPDIR/deploy/images
     eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
     findimage $T $MACHINE $FSTYPE
 
-- 
1.7.10




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

* [PATCH 2/5] runqemu: use modern, single-char name of test(1)
  2012-04-27 14:26 [PATCH 1/5] runqemu: Use OE_TMPDIR Bernhard Reutner-Fischer
@ 2012-04-27 14:26 ` Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 3/5] runqemu: simplify process_filename() Bernhard Reutner-Fischer
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-27 14:26 UTC (permalink / raw)
  To: openembedded-devel

I do not have "[[", just "[". Be gentle to users of legacy-free setups,
also by using '=' instead of the double notation.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 scripts/runqemu |   46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 7c2c4b3..18fd691 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -70,10 +70,10 @@ process_filename() {
             echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
             usage
         fi
-    elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
-            "x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then
+    elif [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
+            "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
         # A file ending in a supportted fs type is a rootfs image
-        if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then
+        if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
             FSTYPE=$EXT
             ROOTFS=$filename
         else
@@ -102,7 +102,7 @@ while [ $i -le $# ]; do
             fi
             ;;
         "ext2" | "ext3" | "jffs2" | "nfs" | "btrfs")
-            if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then
+            if [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ]; then
                 FSTYPE=$arg
             else
                 echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
@@ -143,7 +143,7 @@ while [ $i -le $# ]; do
             # to use simplified options instead
             serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
             kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
-            if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then
+            if [ ! -z "$serial_option" -o ! -z "$kvm_option" ]; then
                 echo "Error: Please use simplified serial or kvm options instead"
                 usage
             fi
@@ -152,7 +152,7 @@ while [ $i -le $# ]; do
             SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
             ;;
         "audio")
-            if [[ "x$MACHINE" == "xqemux86" || "x$MACHINE" == "xqemux86-64" ]]; then
+            if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
                 echo "Enable audio on qemu. Pls. install snd_intel8x0 or snd_ens1370 driver in linux guest.";
                 QEMU_AUDIO_DRV="alsa"
                 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
@@ -166,7 +166,7 @@ while [ $i -le $# ]; do
             # A directory name is an nfs rootfs
             if [ -d "$arg" ]; then
                 echo "Assuming $arg is an nfs rootfs"
-                if [[ -z "$FSTYPE" || "$FSTYPE" == "nfs" ]]; then
+                if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
                     FSTYPE=nfs
                 else
                     echo "Error: conflicting FSTYPE types [$arg] and nfs"
@@ -200,13 +200,13 @@ fi
 
 YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
 # Detect KVM configuration
-if [[ "x$KVM_ENABLED" == "xyes" ]]; then
-    if [[ -z "$KVM_CAPABLE" ]]; then
+if [ "x$KVM_ENABLED" = "xyes" ]; then
+    if [ -z "$KVM_CAPABLE" ]; then
         echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer";
         echo "$YOCTO_KVM_WIKI";
         exit 1;
     fi
-    if [[ "x$MACHINE" != "xqemux86" && "x$MACHINE" != "xqemux86-64" ]]; then
+    if [ "x$MACHINE" != "xqemux86" -a "x$MACHINE" != "xqemux86-64" ]; then
         echo "KVM only support x86 & x86-64. Remove kvm from the command-line";
         exit 1;
     fi
@@ -225,11 +225,11 @@ if [[ "x$KVM_ENABLED" == "xyes" ]]; then
 fi
 
 # Report errors for missing combinations of options
-if [[ -z "$MACHINE" && -z "$KERNEL" ]]; then
+if [ -z "$MACHINE" -a -z "$KERNEL" ]; then
     echo "Error: you must specify at least a MACHINE or KERNEL argument"
     usage
 fi
-if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then
+if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
     echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
     usage
 fi
@@ -313,11 +313,11 @@ findimage() {
     # recently created one is the one we most likely want to boot.
     filenames=`ls -t $where/*-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
+        if [ "$name" =~ core-image-sato-sdk -o \
+              "$name" =~ core-image-sato     -o \
+              "$name" =~ core-image-lsb      -o \
+              "$name" =~ core-image-basic    -o \
+              "$name" =~ core-image-minimal ]; then
             ROOTFS=$name
             return
         fi	
@@ -327,11 +327,11 @@ findimage() {
     exit 1
 }
 
-if [[ -e "$ROOTFS" && -z "$FSTYPE" ]]; then
+if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
     # Extract the filename extension
     EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'`
-    if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" || 
-          "x$EXT" == "xjffs2" || "x$EXT" == "xbtrfs" ]]; then
+    if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \
+          "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
         FSTYPE=$EXT
     else
         echo "Note: Unable to determine filesystem extension for $ROOTFS"
@@ -396,9 +396,9 @@ setup_sysroot
 # We can't run without a libGL.so
 libgl='no'
 
-test -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so && libgl='yes'
-test -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so && libgl='yes'
-test -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so && libgl='yes'
+[ -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so ] && libgl='yes'
+[ -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so ] && libgl='yes'
+[ -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so ] && libgl='yes'
 
 if [ "$libgl" != 'yes' ]; then
     echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.
-- 
1.7.10




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

* [PATCH 3/5] runqemu: simplify process_filename()
  2012-04-27 14:26 [PATCH 1/5] runqemu: Use OE_TMPDIR Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 2/5] runqemu: use modern, single-char name of test(1) Bernhard Reutner-Fischer
@ 2012-04-27 14:26 ` Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 4/5] runqemu: add and use error() Bernhard Reutner-Fischer
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-27 14:26 UTC (permalink / raw)
  To: openembedded-devel

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 scripts/runqemu |   47 +++++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 18fd691..dfa7f4b 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -62,28 +62,31 @@ process_filename() {
 
     # 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" -o "x$EXT" = "xext3" -o \
-            "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then
-        # A file ending in a supportted fs type is a rootfs image
-        if [ -z "$FSTYPE" -o "$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
+    case /$EXT/ in
+	/bin/)
+		# A file ending in .bin is a kernel
+		if [ -z "$KERNEL" ]; then
+		    KERNEL=$filename
+		else
+		    echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
+		    usage
+		fi
+		;;
+	/ext[234]/|/jffs2/|/btrfs/)
+		# A file ending in a supportted fs type is a rootfs image
+		if [ -z "$FSTYPE" -o "$FSTYPE" = "$EXT" ]; then
+		    FSTYPE=$EXT
+		    ROOTFS=$filename
+		else
+		    echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
+		    usage
+		fi
+		;;
+	*)
+		echo "Error: unknown file arg [$filename]"
+		usage
+		;;
+    esac
 }
 
 # Parse command line args without requiring specific ordering. It's a
-- 
1.7.10




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

* [PATCH 4/5] runqemu: add and use error()
  2012-04-27 14:26 [PATCH 1/5] runqemu: Use OE_TMPDIR Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 2/5] runqemu: use modern, single-char name of test(1) Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 3/5] runqemu: simplify process_filename() Bernhard Reutner-Fischer
@ 2012-04-27 14:26 ` Bernhard Reutner-Fischer
  2012-04-27 14:26 ` [PATCH 5/5] runqemu: minor tweaks Bernhard Reutner-Fischer
  2012-04-29  2:37 ` [PATCH 1/5] runqemu: Use OE_TMPDIR Khem Raj
  4 siblings, 0 replies; 6+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-27 14:26 UTC (permalink / raw)
  To: openembedded-devel

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 scripts/runqemu |   71 ++++++++++++++++++++-----------------------------------
 1 file changed, 25 insertions(+), 46 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index dfa7f4b..231b1bf 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -46,6 +46,11 @@ if [ "x$1" = "x" ]; then
     usage
 fi
 
+error() {
+    echo "Error: "$*
+    usage
+}
+
 MACHINE=${MACHINE:=""}
 KERNEL=""
 FSTYPE=""
@@ -65,12 +70,8 @@ process_filename() {
     case /$EXT/ in
 	/bin/)
 		# A file ending in .bin is a kernel
-		if [ -z "$KERNEL" ]; then
-		    KERNEL=$filename
-		else
-		    echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
-		    usage
-		fi
+		[ -z "$KERNEL" ] && KERNEL=$filename || \
+		    error "conflicting KERNEL args [$KERNEL] and [$filename]"
 		;;
 	/ext[234]/|/jffs2/|/btrfs/)
 		# A file ending in a supportted fs type is a rootfs image
@@ -78,13 +79,11 @@ process_filename() {
 		    FSTYPE=$EXT
 		    ROOTFS=$filename
 		else
-		    echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
-		    usage
+		    error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
 		fi
 		;;
 	*)
-		echo "Error: unknown file arg [$filename]"
-		usage
+		error "unknown file arg [$filename]"
 		;;
     esac
 }
@@ -97,20 +96,12 @@ while [ $i -le $# ]; do
     arg=${!i}
     case $arg in
         "qemux86" | "qemux86-64" | "qemuarm" | "qemumips" | "qemuppc")
-            if [ -z "$MACHINE" ]; then
-                MACHINE=$arg
-            else
-                echo "Error: conflicting MACHINE types [$MACHINE] and [$arg]"
-                usage
-            fi
+            [ -z "$MACHINE" ] && MACHINE=$arg || \
+                error "conflicting MACHINE types [$MACHINE] and [$arg]"
             ;;
         "ext2" | "ext3" | "jffs2" | "nfs" | "btrfs")
-            if [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ]; then
-                FSTYPE=$arg
-            else
-                echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
-                usage
-            fi
+            [ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \
+                error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
             ;;
         *-image*)
             if [ -z "$ROOTFS" ]; then
@@ -127,8 +118,7 @@ while [ $i -le $# ]; do
                     LAZY_ROOTFS="true"
                 fi
             else
-                echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]"
-                usage
+                error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
             fi
             ;;
         "nographic")
@@ -146,10 +136,8 @@ while [ $i -le $# ]; do
             # to use simplified options instead
             serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
             kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
-            if [ ! -z "$serial_option" -o ! -z "$kvm_option" ]; then
-                echo "Error: Please use simplified serial or kvm options instead"
-                usage
-            fi
+            [ ! -z "$serial_option" -o ! -z "$kvm_option" ] && \
+                error "Please use simplified serial or kvm options instead"
             ;;
         "bootparams="*)
             SCRIPT_KERNEL_OPT="$SCRIPT_KERNEL_OPT ${arg##bootparams=}"
@@ -172,21 +160,18 @@ while [ $i -le $# ]; do
                 if [ -z "$FSTYPE" -o "$FSTYPE" = "nfs" ]; then
                     FSTYPE=nfs
                 else
-                    echo "Error: conflicting FSTYPE types [$arg] and nfs"
-                    usage
+                    error "conflicting FSTYPE types [$arg] and nfs"
                 fi
 
                 if [ -z "$ROOTFS" ]; then
                     ROOTFS=$arg
                 else
-                    echo "Error: conflicting ROOTFS args [$ROOTFS] and [$arg]"
-                    usage
+                    error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
                 fi
             elif [ -f "$arg" ]; then
                 process_filename $arg
             else
-                echo "Error: unable to classify arg [$arg]"
-                usage
+                error "unable to classify arg [$arg]"
             fi
             ;;
     esac
@@ -229,19 +214,16 @@ fi
 
 # Report errors for missing combinations of options
 if [ -z "$MACHINE" -a -z "$KERNEL" ]; then
-    echo "Error: you must specify at least a MACHINE or KERNEL argument"
-    usage
+    error "you must specify at least a MACHINE or KERNEL argument"
 fi
 if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
-    echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
-    usage
+    error "NFS booting without an explicit ROOTFS path is not yet supported"
 fi
 
 if [ -z "$MACHINE" ]; then
     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
+        error "Unable to set MACHINE from kernel filename [$KERNEL]"
     fi
     echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
 fi
@@ -349,8 +331,7 @@ if [ -z "$KERNEL" ]; then
     KERNEL=$OE_TMPDIR/deploy/images/$kernel_file
 
     if [ -z "$KERNEL" ]; then
-        echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]"
-        usage
+        error "Unable to determine default kernel for MACHINE [$MACHINE]"
     fi
 fi
 # KERNEL is now set for all cases
@@ -359,8 +340,7 @@ if [ -z "$FSTYPE" ]; then
     eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE
 
     if [ -z "$FSTYPE" ]; then
-        echo "Error: Unable to determine default fstype for MACHINE [$MACHINE]"
-        usage
+        error "Unable to determine default fstype for MACHINE [$MACHINE]"
     fi
 fi
 
@@ -381,8 +361,7 @@ if [ -z "$ROOTFS" ]; then
     findimage $T $MACHINE $FSTYPE
 
     if [ -z "$ROOTFS" ]; then
-        echo "Error: Unable to determine default rootfs for MACHINE [$MACHINE]"
-        usage
+        error "Unable to determine default rootfs for MACHINE [$MACHINE]"
     fi
 fi
 # ROOTFS is now set for all cases
-- 
1.7.10




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

* [PATCH 5/5] runqemu: minor tweaks
  2012-04-27 14:26 [PATCH 1/5] runqemu: Use OE_TMPDIR Bernhard Reutner-Fischer
                   ` (2 preceding siblings ...)
  2012-04-27 14:26 ` [PATCH 4/5] runqemu: add and use error() Bernhard Reutner-Fischer
@ 2012-04-27 14:26 ` Bernhard Reutner-Fischer
  2012-04-29  2:37 ` [PATCH 1/5] runqemu: Use OE_TMPDIR Khem Raj
  4 siblings, 0 replies; 6+ messages in thread
From: Bernhard Reutner-Fischer @ 2012-04-27 14:26 UTC (permalink / raw)
  To: openembedded-devel

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 scripts/runqemu |   40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 231b1bf..000d93a 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -104,21 +104,19 @@ while [ $i -le $# ]; do
                 error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
             ;;
         *-image*)
-            if [ -z "$ROOTFS" ]; then
-                if [ -f "$arg" ]; then
-                    process_filename $arg
-                elif [ -d "$arg" ]; then
-                    # Handle the case where the nfsroot dir has -image-
-                    # in the pathname
-                    echo "Assuming $arg is an nfs rootfs"
-                    FSTYPE=nfs
-                    ROOTFS=$arg
-                else
-                    ROOTFS=$arg
-                    LAZY_ROOTFS="true"
-                fi
+            [ -z "$ROOTFS" ] || \
+		error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
+            if [ -f "$arg" ]; then
+                process_filename $arg
+            elif [ -d "$arg" ]; then
+                # Handle the case where the nfsroot dir has -image-
+                # in the pathname
+                echo "Assuming $arg is an nfs rootfs"
+                FSTYPE=nfs
+                ROOTFS=$arg
             else
-                error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
+                ROOTFS=$arg
+                LAZY_ROOTFS="true"
             fi
             ;;
         "nographic")
@@ -144,14 +142,15 @@ while [ $i -le $# ]; do
             ;;
         "audio")
             if [ "x$MACHINE" = "xqemux86" -o "x$MACHINE" = "xqemux86-64" ]; then
-                echo "Enable audio on qemu. Pls. install snd_intel8x0 or snd_ens1370 driver in linux guest.";
+                echo "Enabling audio in qemu."
+                echo "Please install snd_intel8x0 or snd_ens1370 driver in linux guest."
                 QEMU_AUDIO_DRV="alsa"
                 SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -soundhw ac97,es1370"
             fi
             ;;
         "kvm")
             KVM_ENABLED="yes"
-            KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo`
+            KVM_CAPABLE=`grep -q 'vmx\|smx' /proc/cpuinfo && echo 1`
             ;;
         *)
             # A directory name is an nfs rootfs
@@ -190,7 +189,8 @@ YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qe
 # Detect KVM configuration
 if [ "x$KVM_ENABLED" = "xyes" ]; then
     if [ -z "$KVM_CAPABLE" ]; then
-        echo "You are tring to enable KVM on cpu without VT support. Remove kvm from the command-line, or refer";
+        echo "You are trying to enable KVM on a cpu without VT support."
+        echo "Remove kvm from the command-line, or refer"
         echo "$YOCTO_KVM_WIKI";
         exit 1;
     fi
@@ -199,14 +199,16 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then
         exit 1;
     fi
     if [ ! -e /dev/kvm ]; then
-        echo "Missing KVM device. Have you inserted kvm modules? Pls. refer";
+        echo "Missing KVM device. Have you inserted kvm modules?"
+        echo "For further help see"
         echo "$YOCTO_KVM_WIKI";
         exit 1;
     fi
     if 9<>/dev/kvm ; then
         SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm"
     else
-        echo "You have no rights on /dev/kvm. Pls. change the owndership as described at";
+        echo "You have no rights on /dev/kvm."
+        echo "Please change the ownership of this file as described at"
         echo "$YOCTO_KVM_WIKI";
         exit 1;
     fi
-- 
1.7.10




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

* Re: [PATCH 1/5] runqemu: Use OE_TMPDIR
  2012-04-27 14:26 [PATCH 1/5] runqemu: Use OE_TMPDIR Bernhard Reutner-Fischer
                   ` (3 preceding siblings ...)
  2012-04-27 14:26 ` [PATCH 5/5] runqemu: minor tweaks Bernhard Reutner-Fischer
@ 2012-04-29  2:37 ` Khem Raj
  4 siblings, 0 replies; 6+ messages in thread
From: Khem Raj @ 2012-04-29  2:37 UTC (permalink / raw)
  To: openembedded-devel

you should send this patch series to openembedded-core mailing list
they belong there

On Fri, Apr 27, 2012 at 7:26 AM, Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
> The error message erroneously talked about TMPDIR.
> Just use OE_TMPDIR everywhere to make the name of the variable obvious.
>
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
> ---
>  scripts/runqemu |   27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index caabf61..7c2c4b3 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -55,11 +55,6 @@ SCRIPT_QEMU_OPT=""
>  SCRIPT_QEMU_EXTRA_OPT=""
>  SCRIPT_KERNEL_OPT=""
>
> -# Don't use TMPDIR from the external environment, it may be a distro
> -# variable pointing to /tmp (e.g. within X on OpenSUSE)
> -# Instead, use OE_TMPDIR for passing this in externally.
> -TMPDIR="$OE_TMPDIR"
> -
>  # Determine whether the file is a kernel or QEMU image, and set the
>  # appropriate variables
>  process_filename() {
> @@ -273,8 +268,8 @@ SPITZ_DEFAULT_KERNEL=zImage-spitz.bin
>  SPITZ_DEFAULT_FSTYPE=ext3
>
>  setup_tmpdir() {
> -    if [ -z "$TMPDIR" ]; then
> -        # Try to get TMPDIR from bitbake
> +    if [ -z "$OE_TMPDIR" ]; then
> +        # Try to get OE_TMPDIR from bitbake
>         type -P bitbake &>/dev/null || {
>             echo "In order for this script to dynamically infer paths";
>             echo "to kernels or filesystem images, you either need";
> @@ -282,11 +277,11 @@ setup_tmpdir() {
>             echo "before running this script" >&2;
>             exit 1; }
>
> -        # We have bitbake in PATH, get TMPDIR from bitbake
> -        TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
> -        if [ -z "$TMPDIR" ]; then
> +        # We have bitbake in PATH, get OE_TMPDIR from bitbake
> +        OE_TMPDIR=`bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2`
> +        if [ -z "$OE_TMPDIR" ]; then
>             echo "Error: this script needs to be run from your build directory,"
> -            echo "or you need to explicitly set TMPDIR in your environment"
> +            echo "or you need to explicitly set OE_TMPDIR in your environment"
>             exit 1
>         fi
>     fi
> @@ -303,7 +298,7 @@ setup_sysroot() {
>         BUILD_OS=`uname | tr '[A-Z]' '[a-z]'`
>         BUILD_SYS="$BUILD_ARCH-$BUILD_OS"
>
> -        OECORE_NATIVE_SYSROOT=$TMPDIR/sysroots/$BUILD_SYS
> +        OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS
>     fi
>  }
>
> @@ -348,7 +343,7 @@ fi
>  if [ -z "$KERNEL" ]; then
>     setup_tmpdir
>     eval kernel_file=\$${machine2}_DEFAULT_KERNEL
> -    KERNEL=$TMPDIR/deploy/images/$kernel_file
> +    KERNEL=$OE_TMPDIR/deploy/images/$kernel_file
>
>     if [ -z "$KERNEL" ]; then
>         echo "Error: Unable to determine default kernel for MACHINE [$MACHINE]"
> @@ -372,13 +367,13 @@ fi
>  # core-image-sato
>  if [ "$LAZY_ROOTFS" = "true" ]; then
>     setup_tmpdir
> -    echo "Assuming $ROOTFS really means $TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
> -    ROOTFS=$TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
> +    echo "Assuming $ROOTFS really means $OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE"
> +    ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
>  fi
>
>  if [ -z "$ROOTFS" ]; then
>     setup_tmpdir
> -    T=$TMPDIR/deploy/images
> +    T=$OE_TMPDIR/deploy/images
>     eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
>     findimage $T $MACHINE $FSTYPE
>
> --
> 1.7.10
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel



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

end of thread, other threads:[~2012-04-29  2:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 14:26 [PATCH 1/5] runqemu: Use OE_TMPDIR Bernhard Reutner-Fischer
2012-04-27 14:26 ` [PATCH 2/5] runqemu: use modern, single-char name of test(1) Bernhard Reutner-Fischer
2012-04-27 14:26 ` [PATCH 3/5] runqemu: simplify process_filename() Bernhard Reutner-Fischer
2012-04-27 14:26 ` [PATCH 4/5] runqemu: add and use error() Bernhard Reutner-Fischer
2012-04-27 14:26 ` [PATCH 5/5] runqemu: minor tweaks Bernhard Reutner-Fischer
2012-04-29  2:37 ` [PATCH 1/5] runqemu: Use OE_TMPDIR Khem Raj

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