Porting Android-x86 Onto Qemu-KVM

Before you start, you need to install a lot of packages. Please refer to

https://help.ubuntu.com/community/KVM/Installation

1. Creating a new virtual machine

1
$ qemu-img create android-4.0.img 4G

2. Install the system from the cd image (the iso file).

1
$ kvm -m 2047 -cdrom your_iso_file.iso -hda android-4.0.img -boot d

Install the os to the disk as usual.

After creating a faked SD, do not reboot. Shut down the window.

4. Start the virtual machine.

1
$ sudo kvm -m 2047 -hda android-4.0.img -net nic,model=pcnet -net tap

For the memory size, the numbers matter, so don’t be stingy.

Notice the net model should be pcnet and the second -net parameter should betap, which requires root privilege.

If you don’t have a public bridge yet, you need to set up one first. Please refer to

http://www.linux-kvm.org/page/Networking

Briefly, if you are using Ubuntu, the network configuration can be done by doing the follows: (on the host)

1
2
3
4
5
6
7
8
9
10
11
12
# vi /etc/network/interfaces

  # Replace old eth0 config with br0
  auto eth0 br0
  # Use old eth0 config for br0, plus bridge stuff
  iface br0 inet dhcp
          bridge_ports    eth0
          bridge_stp      off
          bridge_maxwait  0
          bridge_fd       0

# /etc/init.d/networking restart

On the guest because you are actually using a virtual eth0 device, you need to modify your /etc/network/interfaces file to configure eth0.