This Post has been updated on 2015 for the Android x86 R2 which now natively supports Hyper-V, see here:
This post is maintained for future reference.
Hi there folks,
Cloud adoption is moving surprisingly fast, with the so called strategy “mobile first, cloud first” I am frequently challenged to demo different business scenarios with Office 365 and Microsoft Azure services being consumed across multiple devices.
As enterprise customers are getting immersed into CYOD/BYOD policies I need to do showcases with different OS’s, so I have a dilemma, I need an additional non-Windows OS/Device but I don’t want to buy one.
With iOS I would need Apple devices – not an option, with Android I have Bluestacks for Android emulation which is a bit intrusive for my Laptop OS/Hyper-V Host or I can run a x86 ported version of Android on a VM, I prefer the latest.
I have already done this exercise before with Android 4.3 Jelly Bean, it has limitations and is a bit unstable and with Android 4.4 (KitKat) RC2 there are a lot of issues being addressed.
If you want to run Android 4.4 x86 RC2 on Hyper-V you will probably struggle a lot because of the Virtualization modules are not being loaded by default, to make the installation possible we need to accomplish some advanced tasks, even though if you follow the steps as described here there’s no room for failure.
Android x86 4.4 RC1 release note
Android x86 4.4 RC2 release note
Part 1: How to install Android x86 4.4 RC2 on Hyper-V: Install
– Phase 1: Download Android x86 4.4 and prepare a VM to run it
– Phase 2: Install Android x86 4.4 on a VM
– Phase 3: Loading Hyper-V modules permanently
Part 2: How to Install Android x86 4.4 RC2 on Hyper-V: Configuration, Screen resolution and Network
– Phase 4: Run and Configure Android x86 for the first time
– Phase 5: Advanced settings – Screen resolution
– Phase 6: Advanced settings – Network configuration
Phase 1: Download Android x86 4.4 RC2 and prepare a VM to run it
1. Download Android ISO: http://www.android-x86.org/releases/releasenote-4-4-rc2
Android Live and Installation ISO
Version: 4.4 RC2 (KitKat-MR1 4.4.2 release)
File name: android-x86-4.4-RC2.iso
2. Open the Hyper-V Manager to Create a Virtual Switch for your Virtual environment Network
On the right pane Click “Virtual Switch Manager”
Create an “Internal” or “External” Virtual Switch depending on your network needs
3. On the Hyper-V Manager create a new Virtual Machine and Virtual Hard Disk:
On the right-pane Actions menu Click “New” –>Virtual Machine
On the New Virtual Machine Wizard –> Next
Define the Machine Machine Name “Android44” and the desired location of the Virtual Machine configuration files
If your are running a Windows 8.1 or Windows Server 2012 R2 host Select the Virtual Machine “Generation 1”
Set the Memory size “1024” MB (add more if needed) and enable “Use Dynamic memory for this Virtual Machine” by ticking the Checkbox
Select the Virtual Switch Network (I will use my “External” vSwitch)
Create a Virtual Hard Disk (default: differential) with no more than “8GB” (should be enough…)
Select “Install Operating System from a Boot CD/DVD” and Select the Android “image file (ISO)”
Review the VM configuration and click “Finish” to complete the VM creation
Phase 2: Install Android x86 4.4 RC2 on a VM
1. Start the VM and on the Boot menu select “Installation – Install Android-x86 to harddisk”
2. After boot Press [ENTER] on the default option “Create Modify partition”
3. As mentioned before the Hyper-V Storage driver (module “hv_storvsc”) is not loaded by default on the build Android 4.4 RC2, so when you click “OK” to create the partition the cfdisk (Linux partition editor) will fail to access the HDD and you’ll see the following error message:
FATAL ERROR: Cannot open disk drive
Press any Key to exit cfdisk
Press any key to exit the black error screen.
4. On the next screen we are informed that the Installation failed.
To fix this we need to load the Hyper Storage module manually from the command Shell, to get there press [CONTROL] + [ALT] + [F2].
5. On the Command Shell type the following to load the Hyper-V Storage Module “hv_storvsc”
# modprobe storvsc
Now press [CONTROL] + [ALT] + [F1] to exit command shell and return to the installation prompt
6. Back to the Installation failure message make sure you select “Retry” and press [ENTER] key
7. You will be presented with “Choose Partition” screen, now you can select “Create/Modify partitions” and press “OK”
8. On Cfdisk partition configuration select “New” and next select “Primary”
9. Confirm the Volume size (e.g 8587.20MB) and mark the Partition as “Bootable” through the menu options
10. Select “Write” and confirm “yes” to write the partition table to disk and select “Quit” to complete
11. Select the new partition installation partition “sda1” and the File system format “ext3”
12. Confirm the partition format “Yes” and confirm the GRUB boot loader install with “Yes”
13. Confirm the read-write directory with “Yes” and wait a few seconds for the installation to complete.
14. Following the last step you will see a screen confirming that the installation was successful.
If you select the option “Run Android-x86” it will fail because the Hyper-V modules are not preloaded by default. We need to make some permanent changes so that Hyper-V modules are loaded every time you boot your VM.
Shut down the VM through the Hyper-V Manager console.
Phase 3: Loading Hyper-V modules permanently
If we attempt to boot the VM after the installation it will fail because the Hyper-V modules are not preloaded by default.
For reference, here is the list and location of each Hyper-V module/driver:
hv_vmbus: Hyper-v virtualization driver
hv_balloon: Hyper-v Dynamic memory driver
hv_utils: Hyper-v integration services
hv_storvsc: Hyper-v Storage Syntethic driver
hv_netvsc: Hyper-v Network Syntethic driver
hid_hyperv: Microsoft Vmbus HID-compliant Mouse
On the following steps we will make changes on the ‘init’ file so that Hyper-V modules/drivers are loaded in Kernel.
1. Boot the VM with the iso image loaded and select the option “Live CD – Debug mode” so that we get a command shell to execute the whole process.
2. On the Live CD Debug mode command shell we will load the Hyper-V Storage module “hv_storvsc” so that we can access our VM HDD and make permanent changes. For that execute the following command:
3. Navigate to a writable folder and mount the Virtual Hard disk partition:
# cd data/
# mkdir mnt
# mknod sda1 b 8 1
# mount sda1 mnt
4. We will make a backup of initrd.img just in case we mess up with it and decompress all the content to a temporary directory:
# cp mnt/android-4.4-RC2/initrd.img initrd.img.bak
# mkdir initrd
# cd initrd/
# gunzip -c ../mnt/android-4.4-RC2/initrd.img | cpio -i
5. Copy all the required Hyper-V modules/drivers from the Live CD to the temporary initrd directory:
# cp /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hv/hv_vmbus.ko .
# cp /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hv/hv_balloon.ko .
# cp /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hv/hv_utils.ko .
# cp /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/hid/hid-hyperv.ko .
# cp /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/net/hyperv/hv_netvsc.ko .
# cp /system/lib/modules/3.10.40-android-x86\+/kernel/drivers/scsi/hv_storvsc.ko .
6. We need to install the Hyper-V loadable modules in the running Kernel by using insmod for each Hyper-v driver. We can do this by editing the ‘init’ file.
You have two options to do this, we can use the ‘sed’ tool to append the information on the ‘init’ file or we can use the ‘vi’ editor to edit the ‘init’ file directly.
Option 1: Using ‘sed’ to append each Hyper-v loadable module:
# sed -i -e ‘118i\insmod hv_vmbus.ko’ -e ‘118i\insmod hv_storvsc.ko’ -e ‘118i\insmod hv_netvsc.ko’ -e ‘118i\insmod hv_utils.ko’ -e ‘118i\insmod hv_balloon.ko’ -e ‘118i\insmod hid-hyperv.ko’ init
We need to load each module just before the line ‘echo –n Detecting Android-x86…’, on this build Android x86 4.4 RC2 the line just before that is the number 118, on future or prior builds that could be different, make sure you verify that and change accordingly if you are not running this build.
After running the above command with ‘sed’ if you edit the init file (vi init) you will notice that starting on the line 118 we have appended each Hyper-v module driver, here is the output:
Option 2: Using ‘vi’ editor to add each Hyper-v loadable module:
Vi editor is old school stuff from the early days of Unix. I will just provide the required steps to use it for this purpose.
Start editing the ‘init’ file with the following command:
With the cursor keys move down to line 118 which should be just before the line ‘echo –n Detecting Android-x86…’. See the print screen:
Now that you are on the line 118 do the following:
Press the [ESC] key to make sure you are on vi command mode.
Press the [o] key to add an additional line (like pressing the Return key on a normal text editor) and add the following text:
Press the [ESC] key to exit from edit mode and go to command mode.
Type the following [:wq] –-> Just what’s between brackets 
Other useful Vi modes (should be enough to edit files):
[ESC] Vi command mode (also stops editing the file)
[i] Insert before cursor
[dd] delete current line
[:q] quit as long as there are not changes
[:q!] Force quit and discard changes
[:wq] or [:x] Write changes and quit
Vi full Cheat Sheet: http://www.lagmonster.org/docs/vi.html
7. Now we need to recreate the initrd image with all Hyper-v drivers included.
# find .| cpio -H newc -o -v | gzip -9 -c > ../mnt/android-4.4-RC2/initrd.img
8. Unmount the Virtual Hard disk partition
# umount ../mnt
9. Shutdown the VM through Hyper-V Manager
This completes the Part 1 of “How to install Android x86 4.4 RC2 on Hyper-V”. You can access the “Part 2: How to Install Android x86 4.4 RC2 on Hyper-V – Part 2: Configuration, Screen resolution and Network”.
R-Tape Loading error,