diff options
author | Cristian Iorga <cristian.iorga@intel.com> | 2012-09-19 10:06:54 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-21 11:10:19 +0100 |
commit | ab2b2a1f2a931258a80ea4e7ed9430aacac591b7 (patch) | |
tree | 085ce4f6e254acbfc2a079256e34ac0ea6b2a885 | |
parent | 32fdbd879c83dae7c23ee0f17d0035bbae832495 (diff) | |
download | poky-ab2b2a1f2a931258a80ea4e7ed9430aacac591b7.tar.gz |
qemux86: Support for KVM, paravirt and virtio added
KVM, paravirtualization and virtio drivers are now activated
in runqemu using the kvm option flag for qemux86.
Host CPU features are also exported to guest OS (Yocto Linux).
Usage example: runqemu qemux86 core-image-x11 kvm
Implements [YOCTO #2550].
(From OE-Core rev: a35d03e2eb905de4eadc9c7df5b50bff1fb7f897)
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-kernel/linux/linux-yocto_3.4.bb | 1 | ||||
-rwxr-xr-x | scripts/runqemu | 16 | ||||
-rwxr-xr-x | scripts/runqemu-internal | 14 |
3 files changed, 27 insertions, 4 deletions
diff --git a/meta/recipes-kernel/linux/linux-yocto_3.4.bb b/meta/recipes-kernel/linux/linux-yocto_3.4.bb index 7c082e75ad..32ae02b512 100644 --- a/meta/recipes-kernel/linux/linux-yocto_3.4.bb +++ b/meta/recipes-kernel/linux/linux-yocto_3.4.bb | |||
@@ -27,4 +27,5 @@ KERNEL_REVISION_CHECKING="" | |||
27 | KERNEL_FEATURES_append = " features/netfilter" | 27 | KERNEL_FEATURES_append = " features/netfilter" |
28 | KERNEL_FEATURES_append_qemux86=" cfg/sound" | 28 | KERNEL_FEATURES_append_qemux86=" cfg/sound" |
29 | KERNEL_FEATURES_append_qemux86-64=" cfg/sound" | 29 | KERNEL_FEATURES_append_qemux86-64=" cfg/sound" |
30 | KERNEL_FEATURES_append_qemux86=" cfg/paravirt_kvm" | ||
30 | KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32", "" ,d)}" | 31 | KERNEL_FEATURES_append = " ${@bb.utils.contains("TUNE_FEATURES", "mx32", " cfg/x32", "" ,d)}" |
diff --git a/scripts/runqemu b/scripts/runqemu index a9f513c7a9..e6e43f20c8 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -208,6 +208,7 @@ if [ -z "$MACHINE" ]; then | |||
208 | fi | 208 | fi |
209 | 209 | ||
210 | YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" | 210 | YOCTO_KVM_WIKI="https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" |
211 | YOCTO_PARAVIRT_KVM_WIKI="https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM" | ||
211 | # Detect KVM configuration | 212 | # Detect KVM configuration |
212 | if [ "x$KVM_ENABLED" = "xyes" ]; then | 213 | if [ "x$KVM_ENABLED" = "xyes" ]; then |
213 | if [ -z "$KVM_CAPABLE" ]; then | 214 | if [ -z "$KVM_CAPABLE" ]; then |
@@ -226,14 +227,27 @@ if [ "x$KVM_ENABLED" = "xyes" ]; then | |||
226 | echo "$YOCTO_KVM_WIKI"; | 227 | echo "$YOCTO_KVM_WIKI"; |
227 | exit 1; | 228 | exit 1; |
228 | fi | 229 | fi |
230 | if [ ! -e /dev/vhost-net ]; then | ||
231 | echo "Missing virtio net device. Have you inserted vhost-net module?" | ||
232 | echo "For further help see" | ||
233 | echo "$YOCTO_PARAVIRT_KVM_WIKI"; | ||
234 | exit 1; | ||
235 | fi | ||
229 | if 9<>/dev/kvm ; then | 236 | if 9<>/dev/kvm ; then |
230 | SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm" | 237 | SCRIPT_QEMU_OPT="$SCRIPT_QEMU_OPT -enable-kvm -cpu host" |
238 | KVM_ACTIVE="yes" | ||
231 | else | 239 | else |
232 | echo "You have no rights on /dev/kvm." | 240 | echo "You have no rights on /dev/kvm." |
233 | echo "Please change the ownership of this file as described at" | 241 | echo "Please change the ownership of this file as described at" |
234 | echo "$YOCTO_KVM_WIKI"; | 242 | echo "$YOCTO_KVM_WIKI"; |
235 | exit 1; | 243 | exit 1; |
236 | fi | 244 | fi |
245 | if [ ! -w /dev/vhost-net -a -r /dev/vhost-net ]; then | ||
246 | echo "You have no rights on /dev/vhost-net." | ||
247 | echo "Please change the ownership of this file as described at" | ||
248 | echo "$YOCTO_PARAVIRT_KVM_WIKI"; | ||
249 | exit 1; | ||
250 | fi | ||
237 | fi | 251 | fi |
238 | 252 | ||
239 | machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` | 253 | machine2=`echo $MACHINE | tr 'a-z' 'A-Z' | sed 's/-/_/'` |
diff --git a/scripts/runqemu-internal b/scripts/runqemu-internal index a9b1c44de4..f2c8d8309f 100755 --- a/scripts/runqemu-internal +++ b/scripts/runqemu-internal | |||
@@ -221,7 +221,15 @@ n2=$(($n1 + 1)) | |||
221 | 221 | ||
222 | KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" | 222 | KERNEL_NETWORK_CMD="ip=192.168.7.$n2::192.168.7.$n1:255.255.255.0" |
223 | QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" | 223 | QEMU_TAP_CMD="-net tap,vlan=0,ifname=$TAP,script=no,downscript=no" |
224 | QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD" | 224 | if [ "$KVM_ACTIVE" = "yes" ]; then |
225 | QEMU_NETWORK_CMD="-net nic,model=virtio $QEMU_TAP_CMD,vhost=on" | ||
226 | DROOT="/dev/vda" | ||
227 | ROOTFS_OPTIONS="-drive file=$ROOTFS,if=virtio" | ||
228 | else | ||
229 | QEMU_NETWORK_CMD="-net nic,vlan=0 $QEMU_TAP_CMD" | ||
230 | DROOT="/dev/hda" | ||
231 | ROOTFS_OPTIONS="-hda $ROOTFS" | ||
232 | fi | ||
225 | KERNCMDLINE="mem=$QEMU_MEMORY" | 233 | KERNCMDLINE="mem=$QEMU_MEMORY" |
226 | QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" | 234 | QEMU_UI_OPTIONS="-show-cursor -usb -usbdevice wacom-tablet" |
227 | 235 | ||
@@ -321,8 +329,8 @@ if [ "$MACHINE" = "qemux86" ]; then | |||
321 | QEMU=qemu-system-i386 | 329 | QEMU=qemu-system-i386 |
322 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" | 330 | QEMU_UI_OPTIONS="$QEMU_UI_OPTIONS -vga vmware" |
323 | if [ "$FSTYPE" = "ext2" -o "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then | 331 | if [ "$FSTYPE" = "ext2" -o "$FSTYPE" = "ext3" -o "$FSTYPE" = "btrfs" ]; then |
324 | KERNCMDLINE="vga=0 root=/dev/hda rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" | 332 | KERNCMDLINE="vga=0 root=$DROOT rw mem=$QEMU_MEMORY $KERNEL_NETWORK_CMD" |
325 | QEMUOPTIONS="$QEMU_NETWORK_CMD -hda $ROOTFS $QEMU_UI_OPTIONS" | 333 | QEMUOPTIONS="$QEMU_NETWORK_CMD $ROOTFS_OPTIONS $QEMU_UI_OPTIONS" |
326 | fi | 334 | fi |
327 | if [ "$FSTYPE" = "nfs" ]; then | 335 | if [ "$FSTYPE" = "nfs" ]; then |
328 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then | 336 | if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then |