aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/runqemu-internal
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-internal
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-internal')
-rwxr-xr-xscripts/runqemu-internal29
1 files changed, 21 insertions, 8 deletions
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal
index ebed2bdd01..0c00d8f9cb 100755
--- a/scripts/runqemu-internal
+++ b/scripts/runqemu-internal
@@ -28,7 +28,6 @@
# ROOTFS - the disk image file to use
#
-
mem_size=-1
#Get rid of <> and get the contents of extra qemu running params
@@ -720,18 +719,32 @@ elif [ "$NUM_SERIAL_OPTS" = "1" ]; then
SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT"
fi
-
echo "Running $QEMU..."
# -no-reboot is a mandatory option - see bug #100
if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then
- echo $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT
- LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT
+ # Check root=/dev/sdX or root=/dev/vdX
+ [ ! -e "$VM" ] && error "VM image is not found!"
+ if grep -q 'root=/dev/sd' $VM; then
+ echo "Using scsi drive"
+ VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd"
+ elif grep -q 'root=/dev/hd' $VM; then
+ echo "Using ide drive"
+ VM_DRIVE="$VM"
+ else
+ echo "Using virtio block drive"
+ VM_DRIVE="-drive if=virtio,file=$VM"
+ fi
+ QEMU_FIRE="$QEMUBIN $VM_DRIVE $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
+ echo $QEMU_FIRE
+ LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE
elif [ "$FSTYPE" = "iso" -o "$FSTYPE" = "wic" ]; then
- echo $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT
- LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT
+ QEMU_FIRE="$QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
+ echo $QEMU_FIRE
+ LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE
else
- echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
- LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT"
+ QEMU_FIRE="$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT"
+ echo $QEMU_FIRE -append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
+ LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE -append "$KERNCMDLINE $SCRIPT_KERNEL_OPT"
fi
ret=$?
if [ "$SLIRP_ENABLED" != "yes" ]; then