diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-02-25 18:06:26 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-25 10:29:14 +0000 |
commit | 6716eb245dcf91b98d8ab9af1ab436f10122b094 (patch) | |
tree | fdac95623556c5efbed8832d606131d63afc2b7e /scripts/runqemu-internal | |
parent | 258cfa891eb65e52a0dd546f3f556da166e7940f (diff) | |
download | poky-6716eb245dcf91b98d8ab9af1ab436f10122b094.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]
(From OE-Core rev: 88c081b10902ec52928be78ad320c474bb918e01)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/runqemu-internal')
-rwxr-xr-x | scripts/runqemu-internal | 29 |
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 @@ | |||
28 | # ROOTFS - the disk image file to use | 28 | # ROOTFS - the disk image file to use |
29 | # | 29 | # |
30 | 30 | ||
31 | |||
32 | mem_size=-1 | 31 | mem_size=-1 |
33 | 32 | ||
34 | #Get rid of <> and get the contents of extra qemu running params | 33 | #Get rid of <> and get the contents of extra qemu running params |
@@ -720,18 +719,32 @@ elif [ "$NUM_SERIAL_OPTS" = "1" ]; then | |||
720 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT" | 719 | SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT $SECOND_SERIAL_OPT" |
721 | fi | 720 | fi |
722 | 721 | ||
723 | |||
724 | echo "Running $QEMU..." | 722 | echo "Running $QEMU..." |
725 | # -no-reboot is a mandatory option - see bug #100 | 723 | # -no-reboot is a mandatory option - see bug #100 |
726 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then | 724 | if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then |
727 | echo $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | 725 | # Check root=/dev/sdX or root=/dev/vdX |
728 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $VM $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | 726 | [ ! -e "$VM" ] && error "VM image is not found!" |
727 | if grep -q 'root=/dev/sd' $VM; then | ||
728 | echo "Using scsi drive" | ||
729 | VM_DRIVE="-drive if=none,id=hd,file=$VM -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=hd" | ||
730 | elif grep -q 'root=/dev/hd' $VM; then | ||
731 | echo "Using ide drive" | ||
732 | VM_DRIVE="$VM" | ||
733 | else | ||
734 | echo "Using virtio block drive" | ||
735 | VM_DRIVE="-drive if=virtio,file=$VM" | ||
736 | fi | ||
737 | QEMU_FIRE="$QEMUBIN $VM_DRIVE $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" | ||
738 | echo $QEMU_FIRE | ||
739 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE | ||
729 | elif [ "$FSTYPE" = "iso" -o "$FSTYPE" = "wic" ]; then | 740 | elif [ "$FSTYPE" = "iso" -o "$FSTYPE" = "wic" ]; then |
730 | echo $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | 741 | QEMU_FIRE="$QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" |
731 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT | 742 | echo $QEMU_FIRE |
743 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE | ||
732 | else | 744 | else |
733 | echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' | 745 | QEMU_FIRE="$QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SLIRP_CMD $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT" |
734 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" | 746 | echo $QEMU_FIRE -append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"' |
747 | LD_PRELOAD="$GL_LD_PRELOAD" $QEMU_FIRE -append "$KERNCMDLINE $SCRIPT_KERNEL_OPT" | ||
735 | fi | 748 | fi |
736 | ret=$? | 749 | ret=$? |
737 | if [ "$SLIRP_ENABLED" != "yes" ]; then | 750 | if [ "$SLIRP_ENABLED" != "yes" ]; then |