Just 做 IT

求知若饥 虚心若愚 안년하세요 (•‾̑⌣‾̑•)

ubuntu14.04 安装HAXM(KVM)提升android虚拟机Android x8运行速度

1 year ago 0

[原文]
Check that your CPU supports hardware virtualization

To run KVM, you need a processor that supports hardware virtualization. Intel and AMD both have developed extensions for their processors, deemed respectively Intel VT-x (code name Vanderpool) and AMD-V (code name Pacifica). To see if your processor supports one of these, you can review the output from this command:


egrep -c '(vmx|svm)' /proc/cpuinfo

If 0 it means that your CPU doesn't support hardware virtualization.

If 1 or more it does - but you still need to make sure that virtualization is enabled in the BIOS.
2.检查是否支持upports kvm,需要安装工具cpu-checker

sudo apt-get install cpu-checker

3.执行检测命令
kvm-ok

which may provide an output like this:


INFO: /dev/kvm exists
KVM acceleration can be used
If you see :

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
You can still run virtual machines, but it'll be much slower without the KVM extensions.

NOTE: You may see a message like "KVM acceleration can/can NOT be used". This is misleading and only means if KVM is *currently* available (i.e. "turned on"), *not* if it is supported.

4 Install Necessary Packages

For the following setup, we will assume that you are deploying KVM on a server, and therefore do not have any X server on the machine.

You need to install a few packages first:

Lucid (10.04) or later


$ sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils

Karmic (9.10) or earlier

$ sudo aptitude install kvm libvirt-bin ubuntu-vm-builder bridge-utils

libvirt-bin provides libvirtd which you need to administer qemu and kvm instances using libvirt

qemu-kvm (kvm in Karmic and earlier) is the backend

ubuntu-vm-builder powerful command line tool for building virtual machines

bridge-utils provides a bridge from your network to the virtual machines

You might also want to install virt-viewer, for viewing instances.

5 添加用户到kvm,libvirtd组


sudo adduser your_user_name kvm
sudo adduser your_user_name libvirtd

安装验证:

sudo virsh -c qemu:///system list

安装成功出现如下命令
Id Name State
----------------------------------
6 通过命令启动虚拟机

<SDK directory>/tools/emulator-x86 -avd Your_AVD_Name -qemu -m 2047 -enable-kvm

7 通过avd manager启动

Run > Run Configurations>Target>Additional Emulator Command Line Options

添加启动参数


-qemu -m 2047 -enable-kvm

over!

Write a Comment