Jump to content

[Guide] How to run Android-x86 on Hyper-V

ionbasa

How to run Android x86 on Hyper-V for Debugging/Developers

 

 

 

Prologue:

Why write this tutorial?

Lack of available information available online and on the Android x86 discussion group. I decided to make a concise tutorial to help fellow developers or anyone who likes to tinker and explore Android.

 

Note: This isn't for the faint of heart. Mouse/pointer integration is minimal and wonky in Hyper-V. Do not expect to run your favorite apps or games under Hyper-V, this is tutorial is for technical reasons, and to help those who want to run an Android client virtualized for purposes of development and debugging. YMMV.

Note: This tutorial assumes you already have Hyper-V installed on your workstation OS (Windows 8.0+) or have the role enabled on Windows Server. I am also assuming you have already set up an external virtual network switch in Hyper-V for network access. An internal only network switch will also suffice if you do not wish to make the Guest OS access the Internet and only want ADB running locally over TCP/IP.

Note: Hardware virtualization is required!!!

Note: You need to know how to use VI.

 

Getting started:

Download the latest release of Android X86 from here: http://www.android-x86.org 

 

At the time of writing this tutorial, the latest version was Android-x86 6.0-r2. I used the 64-bit version. Use whatever bit-ness meets your needs. 64bit builds tend to have a slight performance advantage and can allocate more than 4Gb of RAM.

 

Creating the VM in Hyper-V:

Spoiler
  • First, create a new VM in Hyper-V.

2Uyx2Ra.png

  • Name your VM.

ulF3DIN.png

  • Select Generation 1 VM. A Generation 2 VM will not work properly with this release due to a EFI boot bug that bypasses the live CD boot menu.

Gj4Euek.png

  • Allocate the preferred amount of memory for Android.

hELSsO8.png

  • Set the network switch the VM should use. Here, I used an external switch.

xfzErkR.png

  • Create a new virtual hard disk and set the desired amount of space, adjust to your needs.

JAOW6a4.png

  • Use the Downloaded Android-x86 ISO as the installation media.

CkHXH7J.png

 

G8dALKZ.png

  • Finally, review all settings in the wizard and adjust if needed.

tijTvZu.png

 

Installing Android-x86 in the VM

Spoiler
  • From the Hyper-V Manager, connect to the VM instance.

JVKYn1R.png

  • Now start the instance.

iJJfH6x.png

  • At the boot prompt, select the installation option.

0ezdJl1.png

  • Select "Create/Modify partitions" and select "OK".

A5SR7Qk.png

  • Since this is not a Generation 2 VM and we are not using EFI to boot, select NO when asked to use GPT.

cb5jzZN.png

  • At the cfdisk utility, select 'New' to create a new partition.

HuINKXq.png

  • Select Primary.

xsc6JsP.png

  • Select the default size by pressing Enter on your keyboard.

aEwq4ux.png

  • Select "Bootable", "Maximize" and then "Write". The flags displayed should be the same as in this screenshot.

jA9RMPJ.png

  • Type in "yes" and press Enter when asked if you want to write the partition table to the disk.

HbSJ52T.png

  • Now select "Quit" to exit the partition utility.

AKLZJA8.png

  • Choose "sda1" as the install partition and select "OK".

CRQ0cIG.png

  • Format as "ext4" and select "OK"

C46e4va.png

  • Select "Yes" to confirm formatting the partition.

IsYXWMm.png

  • Wait for the Format to complete.

MiFCPpK.png

  • Select "Yes" to install GRUB.

1Qzppw6.png

  • Select “Yes” to make the system directory read-write.

wjLF11M.png

  • Wait for Android-x86 to install.

Mcss5ts.png

  • Eject the ISO from the VM and then select "Reboot" to restart the VM. We need to configure some boot options to successfully boot the VM.

VddZLWZ.png

 

Adjusting GRUB Boot Options

Spoiler
  • Select and boot the Debug mode.

e8ir3WT.png

  • Wait until "hv_baloon" string is shown, then press the Enter Key to show the shell.

pRexHZC.png

  • Change directories to where GRUB is saved, view files and directories:

cd /mnt/grub
ls

mDiPvEq.png

  • Make a backup copy of the grub menu , then edit the menu file using VI

cp menu.lst menu.lst.bak
vi menu.lst

oec1ZeU.png

  • Adjust the first entry by replacing "quiet" with "vga=(HEX value)". Enter the vga mode desired, here I used "vga=792" which correlates to a vga mode of 1024x768x24. Save the changes and exit VI, then reboot by sending a ctrl-alt-del signal. NOTE: A list of VGA modes for Linux can be found here: https://en.wikipedia.org/wiki/VESA_BIOS_Extensions 

w9kH4So.png

Note: To save and then exit run these inside VI:


:w
:q

 

 

Booting Android-x86

Spoiler
  • Now, let Android-x86 boot normally.

l5O85z8.png

  • The screen resolution has changed. Android-x86 will boot to root shell. Wait a few seconds.

j9FcYs3.png

  • After a short while the graphical interface should start.

qbUoe9d.png

  • Now, go through the initial OOBE. Note: Use the Keyboard buttons (TAB, ENTER, ARROW Keys) to navigate. Mouse integration is bad to say the least, but usable.

pH4iSb1.png

  • Finally, Android-x86 is booted to the home screen.

BIiOPAt.png

 

Enable ADB over TCP/IP

Spoiler
  • Use the arrow keys to navigate to the app-drawer and select the Terminal Emulator. Input the following commands: (adjust port as needed)

su
setprop service.adb.tcp.port 5555
stop adbd
start adbd

8NTz0UD.png

 

 

After-thoughts:

The RDP Hyper-V Virtual Machine Connection is not required after enabling ADB over TCP/IP.

Some better and alternative methods would include running a VNC server or use a ADB utility such as Visor: https://www.vysor.io/ and Airdroid: https://airdroid.com/en/

But there are more than a handful of utilities that do the same thing, see: http://android.stackexchange.com/questions/42105/control-android-with-broken-screen-from-pc 

 

These are outside the scope of this tutorial, but I may do a follow-up.

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

Got an image with a working Play store? Running a Android VM outside of AndroidStudio's AVD is pointless for me unless the VM has the play store. I recall cyanogenmod got into a bit of trouble for distributing google's apps

             ☼

ψ ︿_____︿_ψ_   

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, SCHISCHKA said:

Got an image with a working Play store? Running a Android VM outside of AndroidStudio's AVD is pointless for me unless the VM has the play store. I recall cyanogenmod got into a bit of trouble for distributing google's apps

Android-x86 ships with GAPPS and the Play Store, you have to be signed in:

 

QjbkOeR.png

 

XPcbIQt.png

 

It all works decently well. Other than the mouse integration. It's 'okay' at best.

▶ Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Einstein◀

Please remember to mark a thread as solved if your issue has been fixed, it helps other who may stumble across the thread at a later point in time.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 years later...

Hello.

Excelent explanation,.
I installing Android 6, but have problems with the mouse, i see the arrow and a pint, with the point carry or move the arrow over  where i need, but is very very difficult.
Then, installing Android 7, have a excellent management the mouse, but i cant reduce the vertical resolution, i try with 600*800*32 800*600*32 , 1024*768*32 and 1152*768*32, but all resolutions show a big android desk, i need set in %125 for show the scroll bar and can move with them, my monitor is from notebbok Asus x555LA.


Then, i need fix mouse integration in Android 6 or fix resolution in Android 7.
Can help to fix this?

Thanks for all

Link to comment
Share on other sites

Link to post
Share on other sites

On 8/26/2019 at 3:14 PM, CesarLA said:

Hello.

Excelent explanation,.
I installing Android 6, but have problems with the mouse, i see the arrow and a pint, with the point carry or move the arrow over  where i need, but is very very difficult.
Then, installing Android 7, have a excellent management the mouse, but i cant reduce the vertical resolution, i try with 600*800*32 800*600*32 , 1024*768*32 and 1152*768*32, but all resolutions show a big android desk, i need set in %125 for show the scroll bar and can move with them, my monitor is from notebbok Asus x555LA.


Then, i need fix mouse integration in Android 6 or fix resolution in Android 7.
Can help to fix this?

Thanks for all

Is Solved, just install ANDROID 7 or 8, but not have sound or microphone.

Who know how can use a sound and microphone.?????

Can use like a phone?... with number and sms?

Edited by CesarLA
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×