diff options
author | Liping Ke <liping.ke@intel.com> | 2010-12-16 01:45:30 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-12-16 15:53:09 +0000 |
commit | ae4f5c942ef0561335313d676ff8defc0f0bdbbc (patch) | |
tree | 336f09c5dd7cd7c1ed76f79247750509fd3fbb69 /scripts | |
parent | fded7535b7ebca161f63443815026ee7aa6c2fa5 (diff) | |
download | poky-ae4f5c942ef0561335313d676ff8defc0f0bdbbc.tar.gz |
Add extra parameters options for poky-qemu scripts
In order to support qemu user's flexibility requirement, we add extra
parameter options, user can add extra params such as "<-m 256>"
in poky-qemu script command.
Signed-off-by: Liping ke <liping.ke@intel.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/poky-qemu | 14 | ||||
-rwxr-xr-x | scripts/poky-qemu-internal | 22 |
2 files changed, 34 insertions, 2 deletions
diff --git a/scripts/poky-qemu b/scripts/poky-qemu index 04349879c5..313248ff49 100755 --- a/scripts/poky-qemu +++ b/scripts/poky-qemu | |||
@@ -29,11 +29,14 @@ usage() { | |||
29 | echo " Additional QEMU command-line options can be passed with:" | 29 | echo " Additional QEMU command-line options can be passed with:" |
30 | echo " nographic - disables video console" | 30 | echo " nographic - disables video console" |
31 | echo " serial - enables a serial console on /dev/ttyS0" | 31 | echo " serial - enables a serial console on /dev/ttyS0" |
32 | echo " kvm - enables kvm" | ||
33 | echo " \"<extra-qemu-options>\" - enables extra qemu options, excluding serial and kvm" | ||
32 | echo "" | 34 | echo "" |
33 | echo "Examples:" | 35 | echo "Examples:" |
34 | echo " $MYNAME qemuarm" | 36 | echo " $MYNAME qemuarm" |
35 | echo " $MYNAME qemux86-64 poky-image-sato ext3" | 37 | echo " $MYNAME qemux86-64 poky-image-sato ext3" |
36 | echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" | 38 | echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial" |
39 | echo " $MYNAME qemux86 \"<-m 256>\"" | ||
37 | exit 1 | 40 | exit 1 |
38 | } | 41 | } |
39 | 42 | ||
@@ -47,6 +50,7 @@ FSTYPE="" | |||
47 | ROOTFS="" | 50 | ROOTFS="" |
48 | LAZY_ROOTFS="" | 51 | LAZY_ROOTFS="" |
49 | SCRIPT_QEMU_OPT="" | 52 | SCRIPT_QEMU_OPT="" |
53 | SCRIPT_QEMU_EXTRA_OPT="" | ||
50 | SCRIPT_KERNEL_OPT="" | 54 | SCRIPT_KERNEL_OPT="" |
51 | 55 | ||
52 | TMPDIR="" | 56 | TMPDIR="" |
@@ -129,6 +133,16 @@ while [ $i -le $# ]; do | |||
129 | KVM_ENABLED="yes" | 133 | KVM_ENABLED="yes" |
130 | KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo` | 134 | KVM_CAPABLE=`grep 'vmx\|smx' /proc/cpuinfo` |
131 | ;; | 135 | ;; |
136 | \<*\>) | ||
137 | SCRIPT_QEMU_EXTRA_OPT=$arg | ||
138 | serial_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-serial\)'` | ||
139 | kvm_option=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-enable-kvm\)'` | ||
140 | echo "$kvm_option" | ||
141 | if [[ ! -z "$serial_option" || ! -z "$kvm_option" ]]; then | ||
142 | echo "Error: Please use serial or kvm params instead!" | ||
143 | usage | ||
144 | fi | ||
145 | ;; | ||
132 | *) | 146 | *) |
133 | # A directory name is an nfs rootfs | 147 | # A directory name is an nfs rootfs |
134 | if [ -d "$arg" ]; then | 148 | if [ -d "$arg" ]; then |
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal index ca2511a024..5e74169bdf 100755 --- a/scripts/poky-qemu-internal +++ b/scripts/poky-qemu-internal | |||
@@ -29,6 +29,23 @@ | |||
29 | # ROOTFS - the disk image file to use | 29 | # ROOTFS - the disk image file to use |
30 | # | 30 | # |
31 | 31 | ||
32 | |||
33 | mem_size=-1 | ||
34 | |||
35 | #Get rid of <> and get the contents of extra qemu running params | ||
36 | SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e 's/<//' -e 's/>//'` | ||
37 | #if user set qemu memory, eg: -m 256 in qemu extra params, we need to do some | ||
38 | # validation check | ||
39 | mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'` | ||
40 | if [ ! -z "$mem_set" ] ; then | ||
41 | #Get memory setting size from user input | ||
42 | mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'` | ||
43 | fi | ||
44 | |||
45 | if [ $mem_size -gt 0 ]; then | ||
46 | QEMU_MEMORY="$mem_size"M | ||
47 | fi | ||
48 | |||
32 | if [ -z "$QEMU_MEMORY" ]; then | 49 | if [ -z "$QEMU_MEMORY" ]; then |
33 | case "$MACHINE" in | 50 | case "$MACHINE" in |
34 | "qemux86") | 51 | "qemux86") |
@@ -60,6 +77,7 @@ if [ "$MACHINE" = "qemuarm" ]; then | |||
60 | echo "WARNING: qemuarm does not support > 128M of RAM." | 77 | echo "WARNING: qemuarm does not support > 128M of RAM." |
61 | echo "*** Changing QEMU_MEMORY to default of 128M ***" | 78 | echo "*** Changing QEMU_MEMORY to default of 128M ***" |
62 | QEMU_MEMORY="128M" | 79 | QEMU_MEMORY="128M" |
80 | SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 128/" ` | ||
63 | fi | 81 | fi |
64 | fi | 82 | fi |
65 | 83 | ||
@@ -427,8 +445,8 @@ fi | |||
427 | 445 | ||
428 | echo "Running $QEMU..." | 446 | echo "Running $QEMU..." |
429 | # -no-reboot is a mandatory option - see bug #100 | 447 | # -no-reboot is a mandatory option - see bug #100 |
430 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_CMDLINE_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' | 448 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' |
431 | $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true | 449 | $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" || /bin/true |
432 | 450 | ||
433 | cleanup | 451 | cleanup |
434 | 452 | ||