summaryrefslogtreecommitdiffstats
path: root/yocto-poky/scripts/runqemu-internal
diff options
context:
space:
mode:
Diffstat (limited to 'yocto-poky/scripts/runqemu-internal')
-rwxr-xr-xyocto-poky/scripts/runqemu-internal278
1 files changed, 125 insertions, 153 deletions
diff --git a/yocto-poky/scripts/runqemu-internal b/yocto-poky/scripts/runqemu-internal
index 3b0e54c86..ac1c703c5 100755
--- a/yocto-poky/scripts/runqemu-internal
+++ b/yocto-poky/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
@@ -39,62 +38,8 @@ mem_set=`expr "$SCRIPT_QEMU_EXTRA_OPT" : '.*\(-m[[:space:]] *[0-9]*\)'`
if [ ! -z "$mem_set" ] ; then
#Get memory setting size from user input
mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
-else
- case "$MACHINE" in
- "qemux86")
- mem_size=256
- ;;
- "qemux86-64")
- mem_size=256
- ;;
- "qemuarm")
- mem_size=128
- ;;
- "qemuarm64")
- mem_size=512
- ;;
- "qemumicroblaze")
- mem_size=256
- ;;
- "qemumips"|"qemumips64")
- mem_size=256
- ;;
- "qemuppc")
- mem_size=256
- ;;
- "qemush4")
- mem_size=1024
- ;;
- "qemuzynq")
- mem_size=1024
- ;;
- *)
- mem_size=64
- ;;
- esac
-
fi
-# QEMU_MEMORY has 'M' appended to mem_size
-QEMU_MEMORY="$mem_size"M
-
-# Bug 433: qemuarm cannot use > 256 MB RAM
-if [ "$MACHINE" = "qemuarm" ]; then
- if [ -z "$mem_size" -o $mem_size -gt 256 ]; then
- echo "WARNING: qemuarm does not support > 256M of RAM."
- echo "Changing QEMU_MEMORY to default of 256M."
- QEMU_MEMORY="256M"
- mem_size="256"
- SCRIPT_QEMU_EXTRA_OPT=`echo $SCRIPT_QEMU_EXTRA_OPT | sed -e "s/$mem_set/-m 256/" `
- fi
-fi
-
-# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0
-# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480
-
-if [ -z "$mem_set" ] ; then
- SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size"
-fi
# This file is created when runqemu-gen-tapdevs creates a bank of tap
# devices, indicating that the user should not bring up new ones using
# sudo.
@@ -119,7 +64,7 @@ ORIG_STTY=$(stty -g)
if [ "$SLIRP_ENABLED" = "yes" ]; then
KERNEL_NETWORK_CMD="ip=dhcp"
QEMU_TAP_CMD=""
- QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet"
+ QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice tablet"
QEMU_NETWORK_CMD=""
DROOT="/dev/vda"
ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw"
@@ -268,7 +213,7 @@ else
ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio,format=raw"
KERNCMDLINE="mem=$QEMU_MEMORY"
- QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet"
+ QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice tablet"
NFS_INSTANCE=`echo $TAP | sed 's/tap//'`
export NFS_INSTANCE
@@ -279,35 +224,13 @@ else
fi
fi
-case "$MACHINE" in
- "qemuarm") ;;
- "qemuarm64") ;;
- "qemumicroblaze") ;;
- "qemumips") ;;
- "qemumipsel") ;;
- "qemumips64") ;;
- "qemush4") ;;
- "qemuppc") ;;
- "qemuarmv6") ;;
- "qemuarmv7") ;;
- "qemux86") ;;
- "qemux86-64") ;;
- "qemuzynq") ;;
- "akita") ;;
- "spitz") ;;
- *)
- echo "Error: Unsupported machine type $MACHINE"
- return 1
- ;;
-esac
-
-if [ ! -f "$KERNEL" -a "x$FSTYPE" != "xvmdk" -a "x$FSTYPE" != "xhddimg" -a "x$FSTYPE" != "xhdddirect" ]; then
+if [ ! -f "$KERNEL" -a "$IS_VM" = "false" ]; then
echo "Error: Kernel image file $KERNEL doesn't exist"
cleanup
return 1
fi
-if [ "$FSTYPE" != "nfs" -a "$FSTYPE" != "vmdk" -a "$FSTYPE" != "hddimg" -a "$FSTYPE" != "hdddirect" -a ! -f "$ROOTFS" ]; then
+if [ "$FSTYPE" != "nfs" -a "$IS_VM" = "false" -a ! -f "$ROOTFS" ]; then
echo "Error: Image file $ROOTFS doesn't exist"
cleanup
return 1
@@ -343,13 +266,26 @@ if [ "$FSTYPE" = "nfs" ]; then
NFSRUNNING="true"
fi
-if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarmv7" ]; then
+
+set_mem_size() {
+ if [ ! -z "$mem_set" ] ; then
+ #Get memory setting size from user input
+ mem_size=`echo $mem_set | sed 's/-m[[:space:]] *//'`
+ else
+ mem_size=$1
+ fi
+ # QEMU_MEMORY has 'M' appended to mem_size
+ QEMU_MEMORY="$mem_size"M
+
+}
+
+config_qemuarm() {
+ set_mem_size 128
QEMU=qemu-system-arm
MACHINE_SUBTYPE=versatilepb
export QEMU_AUDIO_DRV="none"
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
- # QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -force-pointer"
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
KERNCMDLINE="root=$DROOT rw console=ttyAMA0,115200 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY highres=off"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M ${MACHINE_SUBTYPE} $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
fi
@@ -368,9 +304,10 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm
if [ "$MACHINE" = "qemuarmv7" ]; then
QEMUOPTIONS="$QEMUOPTIONS -cpu cortex-a8"
fi
-fi
+}
-if [ "$MACHINE" = "qemuarm64" ]; then
+config_qemuarm64() {
+ set_mem_size 512
QEMU=qemu-system-aarch64
QEMU_NETWORK_CMD="-netdev tap,id=net0,ifname=$TAP,script=no,downscript=no -device virtio-net-device,netdev=net0 "
@@ -383,7 +320,7 @@ if [ "$MACHINE" = "qemuarm64" ]; then
else
QEMU_UI_OPTIONS=""
fi
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
KERNCMDLINE="root=$DROOT rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD"
# qemu-system-aarch64 only support '-machine virt -cpu cortex-a57' for now
QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
@@ -397,9 +334,10 @@ if [ "$MACHINE" = "qemuarm64" ]; then
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw console=ttyAMA0,38400 mem=$QEMU_MEMORY highres=off $KERNEL_NETWORK_CMD"
QEMUOPTIONS="$QEMU_NETWORK_CMD -machine virt -cpu cortex-a57 $QEMU_UI_OPTIONS"
fi
-fi
+}
-if [ "$MACHINE" = "qemux86" ]; then
+config_qemux86() {
+ set_mem_size 256
QEMU=qemu-system-i386
if [ "$KVM_ACTIVE" = "yes" ]; then
CPU_SUBTYPE=kvm32
@@ -411,7 +349,7 @@ if [ "$MACHINE" = "qemux86" ]; then
else
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
fi
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
fi
@@ -429,15 +367,16 @@ if [ "$MACHINE" = "qemux86" ]; then
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
fi
- if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then
+ if [ "$IS_VM" = "true" ]; then
QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
fi
# Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
# qemux86 and qemux86-64. We can use timer interrupt mode for now.
KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
-fi
+}
-if [ "$MACHINE" = "qemux86-64" ]; then
+config_qemux86_64() {
+ set_mem_size 256
QEMU=qemu-system-x86_64
if [ "$KVM_ACTIVE" = "yes" ]; then
CPU_SUBTYPE=kvm64
@@ -449,7 +388,7 @@ if [ "$MACHINE" = "qemux86-64" ]; then
else
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware"
fi
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
KERNCMDLINE="vga=0 uvesafb.mode_option=640x480-32 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $ROOTFS_OPTIONS $QEMU_UI_OPTIONS"
fi
@@ -465,29 +404,16 @@ if [ "$MACHINE" = "qemux86-64" ]; then
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS"
fi
- if [ "$FSTYPE" = "vmdk" -o "$FSTYPE" = "hddimg" -o "$FSTYPE" = "hdddirect" ]; then
+ if [ "$IS_VM" = "true" ]; then
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE $QEMU_UI_OPTIONS"
fi
# Currently oprofile's event based interrupt mode doesn't work(Bug #828) in
# qemux86 and qemux86-64. We can use timer interrupt mode for now.
KERNCMDLINE="$KERNCMDLINE oprofile.timer=1"
-fi
-
-if [ "$MACHINE" = "spitz" ]; then
- QEMU=qemu-system-arm
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
- echo $ROOTFS
- ROOTFS=`readlink -f $ROOTFS`
- echo $ROOTFS
- if [ ! -e "$ROOTFS.qemudisk" ]; then
- echo "Adding a partition table to the ext3 image for use by QEMU, please wait..."
- runqemu-addptable2image $ROOTFS $ROOTFS.qemudisk
- fi
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M spitz -hda $ROOTFS.qemudisk -portrait"
- fi
-fi
+}
-if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemumips64" ]; then
+config_qemumips() {
+ set_mem_size 256
case "$MACHINE" in
qemumips) QEMU=qemu-system-mips ;;
qemumipsel) QEMU=qemu-system-mipsel ;;
@@ -495,7 +421,7 @@ if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemum
esac
MACHINE_SUBTYPE=malta
QEMU_UI_OPTIONS="-vga cirrus $QEMU_UI_OPTIONS"
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
#KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
KERNCMDLINE="root=$DROOT rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
@@ -509,9 +435,10 @@ if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemum
KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
fi
-fi
+}
-if [ "$MACHINE" = "qemuppc" ]; then
+config_qemuppc() {
+ set_mem_size 256
QEMU=qemu-system-ppc
MACHINE_SUBTYPE=mac99
CPU_SUBTYPE=G4
@@ -521,7 +448,7 @@ if [ "$MACHINE" = "qemuppc" ]; then
else
QEMU_NETWORK_CMD="-net nic,model=pcnet $QEMU_TAP_CMD"
fi
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
KERNCMDLINE="root=$DROOT rw console=ttyS0 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE $ROOTFS_OPTIONS -no-reboot $QEMU_UI_OPTIONS"
fi
@@ -534,13 +461,14 @@ if [ "$MACHINE" = "qemuppc" ]; then
KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
fi
-fi
+}
-if [ "$MACHINE" = "qemush4" ]; then
+config_qemush4() {
+ set_mem_size 1024
QEMU=qemu-system-sh4
MACHINE_SUBTYPE=r2d
QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS"
- if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" ]; then
+ if [ "${FSTYPE:0:3}" = "ext" -o "$FSTYPE" = "btrfs" -o "$FSTYPE" = "wic" ]; then
#KERNCMDLINE="root=/dev/hda console=ttyS0 console=tty0 $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
KERNCMDLINE="root=/dev/hda rw console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -hda $ROOTFS -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
@@ -556,50 +484,80 @@ if [ "$MACHINE" = "qemush4" ]; then
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
SERIALSTDIO="1"
fi
-fi
-
-if [ "${FSTYPE:0:3}" = "ext" ]; then
- KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE"
-fi
+}
-if [ "$MACHINE" = "akita" ]; then
+config_qemuzynq() {
+ set_mem_size 1024
QEMU=qemu-system-arm
- if [ "$FSTYPE" = "jffs2" ]; then
- ROOTFS=`readlink -f $ROOTFS`
- if [ ! -e "$ROOTFS.qemuflash" ]; then
- echo "Converting raw image into flash image format for use by QEMU, please wait..."
- raw2flash.akita < $ROOTFS > $ROOTFS.qemuflash
- fi
- QEMUOPTIONS="$QEMU_NETWORK_CMD -M akita -mtdblock $ROOTFS.qemuflash -portrait"
+ QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xilinx-zynq-a9 -serial null -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb"
+ # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values
+ SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g')
+ if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then
+ KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
+ QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
fi
-fi
+}
-if [ "$MACHINE" = "qemumicroblaze" ]; then
+config_qemumicroblaze() {
+ set_mem_size 256
QEMU=qemu-system-microblazeel
QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M petalogix-ml605 -serial mon:stdio"
if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then
KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
fi
+}
+
+case "$MACHINE" in
+ "qemuarm" | "qemuarmv6" | "qemuarmv7")
+ config_qemuarm
+ ;;
+ "qemuarm64")
+ config_qemuarm64
+ ;;
+ "qemux86")
+ config_qemux86
+ ;;
+ "qemux86-64")
+ config_qemux86_64
+ ;;
+ "qemumips" | "qemumipsel" | "qemumips64")
+ config_qemumips
+ ;;
+ "qemuppc")
+ config_qemuppc
+ ;;
+ "qemush4")
+ config_qemush4
+ ;;
+ "qemuzynq")
+ config_qemuzynq
+ ;;
+ "qemumicroblaze")
+ config_qemumicroblaze
+ ;;
+ *)
+ echo "Error: Unsupported machine type $MACHINE"
+ return 1
+ ;;
+esac
+
+# We need to specify -m <mem_size> to overcome a bug in qemu 0.14.0
+# https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/584480
+if [ -z "$mem_set" ] ; then
+ SCRIPT_QEMU_EXTRA_OPT="$SCRIPT_QEMU_EXTRA_OPT -m $mem_size"
fi
-if [ "$MACHINE" = "qemuzynq" ]; then
- QEMU=qemu-system-arm
- QEMU_SYSTEM_OPTIONS="$QEMU_NETWORK_CMD -M xilinx-zynq-a9 -serial null -serial mon:stdio -dtb $KERNEL-$MACHINE.dtb"
- # zynq serial ports are named 'ttyPS0' and 'ttyPS1', fixup the default values
- SCRIPT_KERNEL_OPT=$(echo "$SCRIPT_KERNEL_OPT" | sed 's/console=ttyS/console=ttyPS/g')
- if [ "${FSTYPE:0:3}" = "ext" -o "${FSTYPE:0:4}" = "cpio" ]; then
- KERNCMDLINE="earlyprintk root=/dev/ram rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
- QEMUOPTIONS="$QEMU_SYSTEM_OPTIONS -initrd $ROOTFS"
- fi
+if [ "${FSTYPE:0:3}" = "ext" ]; then
+ KERNCMDLINE="$KERNCMDLINE rootfstype=$FSTYPE"
fi
-if [ "x$RAMFS" = "xtrue" ]; then
+if [ "$FSTYPE" = "cpio.gz" ]; then
QEMUOPTIONS="-initrd $ROOTFS -nographic"
KERNCMDLINE="root=/dev/ram0 console=ttyS0 debugshell"
fi
-if [ "x$ISOFS" = "xtrue" ]; then
+if [ "$FSTYPE" = "iso" ]; then
QEMUOPTIONS="$QEMU_NETWORK_CMD -cdrom $ROOTFS $QEMU_UI_OPTIONS"
fi
@@ -720,18 +678,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
-elif [ "$FSTYPE" = "iso" ]; 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
+if [ "$IS_VM" = "true" ]; then
+ # 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
+ 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
OpenPOWER on IntegriCloud