All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/1] Add extra parameters options for poky-qemu scripts
  2010-12-15 17:45 ` [PATCH 1/1] Add extra parameters " Liping Ke
@ 2010-12-15  2:29   ` Scott Garman
  0 siblings, 0 replies; 3+ messages in thread
From: Scott Garman @ 2010-12-15  2:29 UTC (permalink / raw)
  To: poky

On 12/15/2010 09:45 AM, Liping Ke wrote:
> In order to support user's extra requirement for adding extra options for qemu,
> we add extra parameter options, user can add extra parameters such as
> "<-m 256>" in poky-qemu script command.
>
> Signed-off-by: Liping ke<liping.ke@intel.com>

Acked-by: Scott Garman <scott.a.garman@intel.com>

> ---
>   scripts/poky-qemu          |   14 ++++++++++++++
>   scripts/poky-qemu-internal |   22 ++++++++++++++++++++--
>   2 files changed, 34 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/poky-qemu b/scripts/poky-qemu
> index bfeefc7..cd99e0e 100755
> --- a/scripts/poky-qemu
> +++ b/scripts/poky-qemu
> @@ -29,11 +29,14 @@ usage() {
>       echo "  Additional QEMU command-line options can be passed with:"
>       echo "    nographic - disables video console"
>       echo "    serial - enables a serial console on /dev/ttyS0"
> +    echo "    kvm - enables kvm"
> +    echo "    \"<extra-qemu-options>\" - enables extra qemu options, excluding serial and kvm"
>       echo ""
>       echo "Examples:"
>       echo "  $MYNAME qemuarm"
>       echo "  $MYNAME qemux86-64 poky-image-sato ext3"
>       echo "  $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
> +    echo "  $MYNAME qemux86 \"<-m 256>\""
>       exit 1
>   }
>
> @@ -47,6 +50,7 @@ FSTYPE=""
>   ROOTFS=""
>   LAZY_ROOTFS=""
>   SCRIPT_QEMU_OPT=""
> +SCRIPT_QEMU_EXTRA_OPT=""
>   SCRIPT_KERNEL_OPT=""
>
>   TMPDIR=""
> @@ -129,6 +133,16 @@ while [ $i -le $# ]; do
>               KVM_ENABLED="yes"
>               KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo`
>               ;;
> +        \<*\>)
> +            SCRIPT_QEMU_EXTRA_OPT=$arg
> +            serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
> +            kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
> +            echo "$kvm_option"
> +            if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then
> +                echo "Error: Please use serial or kvm params instead!"
> +                usage
> +            fi
> +            ;;
>           *)
>               # A directory name is an nfs rootfs
>               if [ -d "$arg" ]; then
> diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
> index ca2511a..5e74169 100755
> --- a/scripts/poky-qemu-internal
> +++ b/scripts/poky-qemu-internal
> @@ -29,6 +29,23 @@
>   #   ROOTFS - the disk image file to use
>   #
>
> +
> +mem_size=-1
> +
> +#Get rid of<>  and get the contents of extra qemu running params
> +SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'`
> +#if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some
> +# validation check
> +mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'`
> +if [ ! -z "$mem_set" ] ; then
> +#Get memory setting size from user input
> +  mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
> +fi
> +
> +if [ $mem_size -gt 0 ]; then
> +  QEMU_MEMORY="$mem_size"M
> +fi
> +
>   if [ -z "$QEMU_MEMORY" ]; then
>       case "$MACHINE" in
>           "qemux86")
> @@ -60,6 +77,7 @@ if [ "$MACHINE" = "qemuarm" ]; then
>           echo "WARNING: qemuarm does not support>  128M of RAM."
>           echo "*** Changing QEMU_MEMORY to default of 128M ***"
>           QEMU_MEMORY="128M"
> +        SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 128/" `
>       fi
>   fi
>
> @@ -427,8 +445,8 @@ fi
>
>   echo "Running $QEMU..."
>   # -no-reboot is a mandatory option - see bug #100
> -echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_CMDLINE_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
> -$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true
> +echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
> +$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true
>
>   cleanup
>


-- 
Scott Garman
Embedded Linux Distro Engineer - Yocto Project


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

* [PATCH 1/1] Add extra parameters options for poky-qemu scripts
  2010-12-15 18:09 [PATCH 0/1] Add extra parameter options for poky-qemu scripts Liping Ke
@ 2010-12-15 17:45 ` Liping Ke
  2010-12-15  2:29   ` Scott Garman
  0 siblings, 1 reply; 3+ messages in thread
From: Liping Ke @ 2010-12-15 17:45 UTC (permalink / raw)
  To: poky

In order to support user's extra requirement for adding extra options for qemu,
we add extra parameter options, user can add extra parameters such as
"<-m 256>" in poky-qemu script command.

Signed-off-by: Liping ke <liping.ke@intel.com>
---
 scripts/poky-qemu          |   14 ++++++++++++++
 scripts/poky-qemu-internal |   22 ++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index bfeefc7..cd99e0e 100755
--- a/scripts/poky-qemu
+++ b/scripts/poky-qemu
@@ -29,11 +29,14 @@ usage() {
     echo "  Additional QEMU command-line options can be passed with:"
     echo "    nographic - disables video console"
     echo "    serial - enables a serial console on /dev/ttyS0"
+    echo "    kvm - enables kvm"
+    echo "    \"<extra-qemu-options>\" - enables extra qemu options, excluding serial and kvm"
     echo ""
     echo "Examples:"
     echo "  $MYNAME qemuarm"
     echo "  $MYNAME qemux86-64 poky-image-sato ext3"
     echo "  $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
+    echo "  $MYNAME qemux86 \"<-m 256>\""
     exit 1
 }
 
@@ -47,6 +50,7 @@ FSTYPE=""
 ROOTFS=""
 LAZY_ROOTFS=""
 SCRIPT_QEMU_OPT=""
+SCRIPT_QEMU_EXTRA_OPT=""
 SCRIPT_KERNEL_OPT=""
 
 TMPDIR=""
@@ -129,6 +133,16 @@ while [ $i -le $# ]; do
             KVM_ENABLED="yes"
             KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo`
             ;;
+        \<*\>)
+            SCRIPT_QEMU_EXTRA_OPT=$arg 
+            serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'`
+            kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'`
+            echo "$kvm_option"
+            if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then
+                echo "Error: Please use serial or kvm params instead!"
+                usage
+            fi
+            ;;
         *)
             # A directory name is an nfs rootfs
             if [ -d "$arg" ]; then
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
index ca2511a..5e74169 100755
--- a/scripts/poky-qemu-internal
+++ b/scripts/poky-qemu-internal
@@ -29,6 +29,23 @@
 #   ROOTFS - the disk image file to use
 #
 
+
+mem_size=-1
+
+#Get rid of <> and get the contents of extra qemu running params
+SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'`
+#if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some 
+# validation check
+mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'`
+if [ ! -z "$mem_set" ] ; then
+#Get memory setting size from user input
+  mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
+fi
+
+if [ $mem_size -gt 0 ]; then
+  QEMU_MEMORY="$mem_size"M
+fi
+
 if [ -z "$QEMU_MEMORY" ]; then
     case "$MACHINE" in
         "qemux86")
@@ -60,6 +77,7 @@ if [ "$MACHINE" = "qemuarm" ]; then
         echo "WARNING: qemuarm does not support > 128M of RAM."
         echo "*** Changing QEMU_MEMORY to default of 128M ***"
         QEMU_MEMORY="128M"
+        SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 128/" `
     fi
 fi
 
@@ -427,8 +445,8 @@ fi
 
 echo "Running $QEMU..."
 # -no-reboot is a mandatory option - see bug #100
-echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_CMDLINE_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
-$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true
+echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
+$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true
 
 cleanup
 
-- 
1.7.0.4



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

* [PATCH 0/1] Add extra parameter options for poky-qemu scripts
@ 2010-12-15 18:09 Liping Ke
  2010-12-15 17:45 ` [PATCH 1/1] Add extra parameters " Liping Ke
  0 siblings, 1 reply; 3+ messages in thread
From: Liping Ke @ 2010-12-15 18:09 UTC (permalink / raw)
  To: poky


In order to support user's extra requirement for adding extra options for qemu,
we add extra parameter options, user can add extra parameters such as
"<-m 256>" in poky-qemu script command.



Pull URL: git://git.pokylinux.org/poky-contrib.git
  Branch: lke/qemu_extra_option
  Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=lke/qemu_extra_option

Thanks,
    Liping Ke <liping.ke@intel.com>
---


Liping Ke (1):
  Add extra parameters options for poky-qemu scripts

 scripts/poky-qemu          |   14 ++++++++++++++
 scripts/poky-qemu-internal |   22 ++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)



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

end of thread, other threads:[~2010-12-15  2:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15 18:09 [PATCH 0/1] Add extra parameter options for poky-qemu scripts Liping Ke
2010-12-15 17:45 ` [PATCH 1/1] Add extra parameters " Liping Ke
2010-12-15  2:29   ` Scott Garman

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.