aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-02-25 18:06:26 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-23 14:24:25 +0000
commit88c081b10902ec52928be78ad320c474bb918e01 (patch)
treef53b404aa75fbbf1ec47947515ac35d26ca7bf6a /scripts/runqemu
parent8cc5e36cd7978186d5ea1fe8af2f2bd6b3df8885 (diff)
downloadopenembedded-core-contrib-88c081b10902ec52928be78ad320c474bb918e01.tar.gz
runqemu: fix ROOTFS for vmdk
* Make it can boot scsi and virtio block drive such as root=/dev/sdX and /dev/vdX. * Drop VM from help info, id doesn't work, and the script can check whether it is a vm disk or not. * Make it can be run by: $ runqemu tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.vmdk or: $ runqemu qemux86-64 vmdk [YOCTO #9170] Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Diffstat (limited to 'scripts/runqemu')
-rwxr-xr-xscripts/runqemu77
1 files changed, 40 insertions, 37 deletions
diff --git a/scripts/runqemu b/scripts/runqemu
index 48b7551464d..771aa3878db 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -19,35 +19,36 @@
usage() {
MYNAME=`basename $0`
- echo ""
- echo "Usage: you can run this script with any valid combination"
- echo "of the following environment variables (in any order):"
- echo " KERNEL - the kernel image file to use"
- echo " ROOTFS - the rootfs image file or nfsroot directory to use"
- echo " MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)"
- echo " RAMFS - boot a ramfs-based image"
- echo " ISO - boot an ISO image"
- echo " VM - boot a virtual machine image (= a file representing a full disk with boot loader)"
- echo " Simplified 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 when running qemux86/qemux86-64 (VT-capable CPU required)"
- echo " kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)"
- echo " publicvnc - enable a VNC server open to all hosts"
- echo " qemuparams=\"xyz\" - specify custom parameters to QEMU"
- echo " bootparams=\"xyz\" - specify custom kernel parameters during boot"
- echo ""
- echo "Examples:"
- echo " $MYNAME qemuarm"
- echo " $MYNAME qemux86-64 core-image-sato ext4"
- echo " $MYNAME qemux86-64 wic-image-minimal wic"
- echo " $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial"
- echo " $MYNAME qemux86 ramfs"
- echo " $MYNAME qemux86 iso"
- echo " $MYNAME qemux86 qemuparams=\"-m 256\""
- echo " $MYNAME qemux86 bootparams=\"psplash=false\""
- echo " $MYNAME path/to/<image>-<machine>.vmdk"
- echo " $MYNAME path/to/<image>-<machine>.wic"
+cat <<_EOF
+
+Usage: you can run this script with any valid combination
+of the following environment variables (in any order):
+ KERNEL - the kernel image file to use
+ ROOTFS - the rootfs image file or nfsroot directory to use
+ MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified)
+ RAMFS - boot a ramfs-based image
+ ISO - boot an ISO image
+ Simplified QEMU command-line options can be passed with:
+ nographic - disables video console
+ serial - enables a serial console on /dev/ttyS0
+ kvm - enables KVM when running qemux86/qemux86-64 (VT-capable CPU required)
+ kvm-vhost - enables KVM with vhost support when running qemux86/qemux86-64 (VT-capable CPU required)
+ publicvnc - enable a VNC server open to all hosts
+ qemuparams="xyz" - specify custom parameters to QEMU
+ bootparams="xyz" - specify custom kernel parameters during boot
+
+Examples:
+ $MYNAME qemuarm
+ $MYNAME qemux86-64 core-image-sato ext4
+ $MYNAME qemux86-64 wic-image-minimal wic
+ $MYNAME path/to/bzImage-qemux86.bin path/to/nfsrootdir/ serial
+ $MYNAME qemux86 ramfs
+ $MYNAME qemux86 iso
+ $MYNAME qemux86 qemuparams="-m 256"
+ $MYNAME qemux86 bootparams="psplash=false"
+ $MYNAME path/to/<image>-<machine>.vmdk
+ $MYNAME path/to/<image>-<machine>.wic
+_EOF
exit 1
}
@@ -63,7 +64,6 @@ error() {
MACHINE=${MACHINE:=""}
KERNEL=${KERNEL:=""}
ROOTFS=${ROOTFS:=""}
-VM=${VM:=""}
FSTYPE=${FSTYPE:=""}
LAZY_ROOTFS=""
SCRIPT_QEMU_OPT=""
@@ -101,6 +101,7 @@ process_filename() {
/hddimg/|/hdddirect/|/vmdk/)
FSTYPE=$EXT
VM=$filename
+ ROOTFS=$filename
;;
*)
error "unknown file arg [$filename]"
@@ -118,7 +119,7 @@ while true; do
[ -z "$MACHINE" -o "$MACHINE" = "$arg" ] && MACHINE=$arg || \
error "conflicting MACHINE types [$MACHINE] and [$arg]"
;;
- "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs" | "hddimg" | "hdddirect" | "wic" )
+ "ext2" | "ext3" | "ext4" | "jffs2" | "nfs" | "btrfs" | "hddimg" | "hdddirect" | "wic" | "vmdk")
[ -z "$FSTYPE" -o "$FSTYPE" = "$arg" ] && FSTYPE=$arg || \
error "conflicting FSTYPE types [$FSTYPE] and [$arg]"
;;
@@ -127,8 +128,8 @@ while true; do
RAMFS=true
;;
"iso")
- FSTYPE=iso
- ISOFS=true
+ FSTYPE=iso
+ ISOFS=true
;;
"nographic")
SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -nographic"
@@ -142,7 +143,7 @@ while true; do
"tcpserial="*)
TCPSERIAL_PORTNUM=${arg##tcpserial=}
;;
- "biosdir="*)
+ "biosdir="*)
CUSTOMBIOSDIR="${arg##biosdir=}"
;;
"biosfilename="*)
@@ -187,7 +188,7 @@ while true; do
;;
*-image*)
[ -z "$ROOTFS" ] || \
- error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
+ error "conflicting ROOTFS args [$ROOTFS] and [$arg]"
if [ -f "$arg" ]; then
process_filename $arg
elif [ -d "$arg" ]; then
@@ -237,7 +238,7 @@ fi
# Report errors for missing combinations of options
if [ -z "$MACHINE" -a -z "$KERNEL" -a -z "$VM" -a "$FSTYPE" != "wic" ]; then
- error "you must specify at least a MACHINE, VM, or KERNEL argument"
+ error "you must specify at least a MACHINE or KERNEL argument"
fi
if [ "$FSTYPE" = "nfs" -a -z "$ROOTFS" ]; then
error "NFS booting without an explicit ROOTFS path is not yet supported"
@@ -489,7 +490,7 @@ if [ "$LAZY_ROOTFS" = "true" ]; then
fi
fi
-if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" ]; then
+if [ -z "$ROOTFS" ]; then
setup_path_vars 1
T=$DEPLOY_DIR_IMAGE
eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS
@@ -497,6 +498,8 @@ if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTY
if [ -z "$ROOTFS" ]; then
error "Unable to determine default rootfs for MACHINE [$MACHINE]"
+ elif [ "x$FSTYPE" = "xvmdk" -o "x$FSTYPE" = "xhddimg" -o "x$FSTYPE" = "xhdddirect" ]; then
+ VM=$ROOTFS
fi
fi
# ROOTFS is now set for all cases, now expand it to be an absolute path, it should exist at this point