summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu39
1 files changed, 29 insertions, 10 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index fb7ac56398..190e3b41de 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -27,6 +27,7 @@ usage() {
27 echo " ROOTFS - the rootfs image file or nfsroot directory to use" 27 echo " ROOTFS - the rootfs image file or nfsroot directory to use"
28 echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)" 28 echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)"
29 echo " RAMFS - boot a ramfs-based image" 29 echo " RAMFS - boot a ramfs-based image"
30 echo " VM - boot a vmdk image"
30 echo " Simplified QEMU command-line options can be passed with:" 31 echo " Simplified QEMU command-line options can be passed with:"
31 echo " nographic - disables video console" 32 echo " nographic - disables video console"
32 echo " serial - enables a serial console on /dev/ttyS0" 33 echo " serial - enables a serial console on /dev/ttyS0"
@@ -41,6 +42,7 @@ usage() {
41 echo " $MYNAME qemux86 ramfs" 42 echo " $MYNAME qemux86 ramfs"
42 echo " $MYNAME qemux86 qemuparams=\"-m 256\"" 43 echo " $MYNAME qemux86 qemuparams=\"-m 256\""
43 echo " $MYNAME qemux86 bootparams=\"psplash=false\"" 44 echo " $MYNAME qemux86 bootparams=\"psplash=false\""
45 echo " $MYNAME path/to/<image>-<machine>.vmdk"
44 exit 1 46 exit 1
45} 47}
46 48
@@ -56,6 +58,7 @@ error() {
56MACHINE=${MACHINE:=""} 58MACHINE=${MACHINE:=""}
57KERNEL=${KERNEL:=""} 59KERNEL=${KERNEL:=""}
58ROOTFS=${ROOTFS:=""} 60ROOTFS=${ROOTFS:=""}
61VM=${VM:=""}
59FSTYPE="" 62FSTYPE=""
60LAZY_ROOTFS="" 63LAZY_ROOTFS=""
61SCRIPT_QEMU_OPT="" 64SCRIPT_QEMU_OPT=""
@@ -84,6 +87,10 @@ process_filename() {
84 error "conflicting FSTYPE types [$FSTYPE] and [$EXT]" 87 error "conflicting FSTYPE types [$FSTYPE] and [$EXT]"
85 fi 88 fi
86 ;; 89 ;;
90 /vmdk/)
91 FSTYPE=$EXT
92 VM=$filename
93 ;;
87 *) 94 *)
88 error "unknown file arg [$filename]" 95 error "unknown file arg [$filename]"
89 ;; 96 ;;
@@ -192,19 +199,27 @@ elif [ ! -w /dev/net/tun ] ; then
192fi 199fi
193 200
194# Report errors for missing combinations of options 201# Report errors for missing combinations of options
195if [ -z "$MACHINE" -a -z "$KERNEL" ]; then 202if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" ]; then
196 error "you must specify at least a MACHINE or KERNEL argument" 203 error "you must specify at least a MACHINE, VM, or KERNEL argument"
197fi 204fi
198if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then 205if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
199 error "NFS booting without an explicit ROOTFS path is not yet supported" 206 error "NFS booting without an explicit ROOTFS path is not yet supported"
200fi 207fi
201 208
202if [ -z "$MACHINE" ]; then 209if [ -z "$MACHINE" ]; then
203 MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'` 210 if [ "x$FSTYPE" = "xvmdk" ]; then
204 if [ -z "$MACHINE" ]; then 211 MACHINE=`basename $VM | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'`
205 error "Unable to set MACHINE from kernel filename [$KERNEL]" 212 if [ -z "$MACHINE" ]; then
213 error "Unable to set MACHINE from vmdk filename [$VM]"
214 fi
215 echo "Set MACHINE to [$MACHINE] based on vmdk [$VM]"
216 else
217 MACHINE=`basename $KERNEL | sed 's/.*\(qemux86-64\|qemux86\|qemuarm\|qemumips64\|qemumips\|qemuppc\|qemush4\).*/\1/'`
218 if [ -z "$MACHINE" ]; then
219 error "Unable to set MACHINE from kernel filename [$KERNEL]"
220 fi
221 echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
206 fi 222 fi
207 echo "Set MACHINE to [$MACHINE] based on kernel [$KERNEL]"
208fi 223fi
209 224
210YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" 225YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu"
@@ -366,7 +381,7 @@ if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then
366 fi 381 fi
367fi 382fi
368 383
369if [ -z "$KERNEL" ]; then 384if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then
370 setup_tmpdir 385 setup_tmpdir
371 eval kernel_file=\$${machine2}_DEFAULT_KERNEL 386 eval kernel_file=\$${machine2}_DEFAULT_KERNEL
372 KERNEL=$OE_TMPDIR/deploy/images/$kernel_file 387 KERNEL=$OE_TMPDIR/deploy/images/$kernel_file
@@ -395,7 +410,7 @@ if [ "$LAZY_ROOTFS" = "true" ]; then
395 ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE 410 ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE
396fi 411fi
397 412
398if [ -z "$ROOTFS" ]; then 413if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then
399 setup_tmpdir 414 setup_tmpdir
400 T=$OE_TMPDIR/deploy/images 415 T=$OE_TMPDIR/deploy/images
401 eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS 416 eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
@@ -409,8 +424,12 @@ fi
409 424
410echo "" 425echo ""
411echo "Continuing with the following parameters:" 426echo "Continuing with the following parameters:"
412echo "KERNEL: [$KERNEL]" 427if [ "x$FSTYPE" != "xvmdk" ]; then
413echo "ROOTFS: [$ROOTFS]" 428 echo "KERNEL: [$KERNEL]"
429 echo "ROOTFS: [$ROOTFS]"
430else
431 echo "VMDK: [$VM]"
432fi
414echo "FSTYPE: [$FSTYPE]" 433echo "FSTYPE: [$FSTYPE]"
415 434
416setup_sysroot 435setup_sysroot