"Go" How to-Start Intel hardware-assisted Virtualization (hypervisor) on Linux to speed-up Intel Android x86 Emulator

Source: Internet
Author: User
Tags android sdk manager egrep

"Go" How to-Start Intel hardware-assisted Virtualization (hypervisor) on Linux to speed-up Intel Android x86 Emulator

The Intel Hardware accelerated execution Manager (INTEL®HAXM) is a hardware-assisted virtualization engine (hypervisor) t Hat uses Intel Virtualization Technology (VT) to speed up Android apps emulation on a host machine. In combination with Android x86 emulator images provided by Intel and the official Android SDK Manager, HAXM allows for FA Ster Android emulation on Intel VT enabled systems. HAXM for both Windows and OS X is available now.

Since Google mainly supports Android build on Linux platform (with Ubuntu 64-bit OS as top Linux platform, and OS X as 2nd ), and a lot of Android developers be using AVD on Eclipse or Android Studio hosted by a Linux system, it's very critica L that Android developers take advantage of the Intel hardware-assisted KVM virtualization for Linux just like HAXM for Window S and OS x.

Below is the quick step-by-step ' on what to install, enable KVM on Ubuntu host platform and start Intel Android x86 Emul Ator with Intel hardware-assisted virtualization (hypervisor). The result is very pleasing and AVD runs significantly faster and smoother than without hypervisor.

KVM Installation

I referred the instructions from Ubuntu Community Documentation page. To get KVM installed. To see if your processor supports hardware virtualization, you can review the output from this command:

$ Egrep-c ' (VMX|SVM) '/proc/cpuinfo

If the output is 0 it means this your CPU doesn ' t support hardware virtualization.

Next is to install CPU checker:

$ sudo apt-get install Cpu-checker

Now you can check if your CPU supports KVM:

$sudo Kvm-ok

and insert root password

If you see:
"Info:your CPU supports KVM extensions
KVM acceleration can be used "

It means you can run your virtual machine faster with the KVM extensions.

If you see:
"INFO:KVM is disabled by your BIOS
Hint:enter your BIOS Setup and enable virtualization Technology (VT),
And then hard Poweroff/poweron your system
KVM acceleration can used "

You need to go to BIOS setup and enable the VT.

Use a of the bit kernel

Running a 64bit kernel on the host operating system was recommended since Google no longer offers support for 32bit kernel. .
This allows the serving of more than 2GB of RAM for your VMs.
Also, a 64-bit system can host both 32-bit and 64-bit guests. A 32-bit system can only host 32-bit guests.
To see if your processor are 64-bit, you can run the This command:

$ Egrep-c ' lm '/proc/cpuinfo

If 0 is printed, it means the your CPU is not 64-bit.
If 1 or higher, it is. NOTE:LM stands for Long Mode which equates to a 64-bit CPU.
Now see if your running kernel is 64-bit, just issue the following command:

$ uname-m

X86_64 indicates a running 64-bit kernel. If you see i386, i486, i586 or i686, you ' re running a 32-bit kernel.

Install KVM

For Ubuntu Lucid (12.04 LTS precise) or later:

$ sudo apt-get install QEMU-KVM libvirt-bin ubuntu-vm-builder bridge-utils ia32-libs-multiarch

If It is displayed, ignore the Postfix configuration below by selecting "No Configuration"

Next is to add your <username> account to the groupKVMandLIBVIRTD

$ sudo adduser your_user_name KVM
$ sudo adduser your_user_name LIBVIRTD

After the installation, you need-relogin so, your user account becomes an effective member of KVM and LIBVIRTD user Groups. The members of this group can run virtual machines.

Verify Installation
You can test if your install have been successful with the following command:
$ sudo virsh-c qemu:///system list
Your screen would paint the following below if successful:
Id Name State

Install Java

Please referred to the instructions from Ubuntu Community documentation page to get Java installed. There is four implementations of Java. Oracle Java 7 have to is installed in order to run Android Emulator x86 system Images.

Start the AVD from Android SDK Directly from Terminal

Documented information on what to install Android SDK or Android Sudio can is found on Android developers website.

After installing Android SDK a new Vsan can be created using virtual Device Manager. Make sure, installation OS system variable Ld_library_path point to <sdk directory>/tools/lib64

Type in a terminal:

$android AVD

Android Virtual Device Manager is started. Click on the Create button and fallow the wizard remembering the "virtual machine" name and selecting x86 system image in CP U/abi section

Now start the Android for x86 Intel Emulator using the following command:

$ <sdk DIRECTORY>/TOOLS/EMULATOR64-X86-AVD your_avd_name-qemu-m 2047-ENABLE-KVM

Only a 64-bits Ubuntu can allow you to run allocated Memory of 2G or more. My 64-bit Ubuntu have 6G of Memory, so I used 1/3 of it for Android AVD. My AVD name is intel_atom_x86_64. '-qemu ' provides the options to QEMU, and '-m ' specifies the amount of memory for the emulated Android (i.e. guest). If You use too small value for that, it's possible that performance are bad because of frequent swapping activities. Add '-show-kernel ' to see the message from the kernel.

Start the AVD by AvD Manager in Android Studio

Below is the recommended procedure. If you is running the emulator from Android emulator, run your Android application with an x86-based AVD and include the KVM options:

    • In Android Studio, click your Android project folder and then select Run > Edit Configurations
    • Click the Emulator tab
    • Check Additional command line Options and in the input field enter:

-qemu–m 2047-ENABLE-KVM

      • Run your Android project using this run configuration.

"Go" How to-Start Intel hardware-assisted Virtualization (hypervisor) on Linux to speed-up Intel Android x86 Emulator

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.