Android-x86 Virtual Machine installation Configuration Overview

Source: Internet
Author: User
Document directory
  • 1. Add custom resolutions to virtual machines
  • 2. Modify menu. lst of grub.
  • 3. Restart the Android-x86 in debug mode
  • 1. Install the application
  • 2. Uninstall

Android-x86 Virtual Machine installation configuration has a lot of online, but all the instructions are not much white, I hope this article can introduce the main configuration to you, to help you take less detours.

This article introduces the installation and configuration methods for VMWare and Virtual Box Virtual machines, and describes how to use eclipse for debugging.

1. Installing Android-x86 virtual machines 1. Installing Android-x86 with vmware

Download the installation package at http://www.android-x86.org/downloadand the isofile of eeepc.pdf. This example uses version 4.0 RC2 as an example.

Run vmware to create a VM:

2. virtual box installation Android-x86

Create a new machine in Virtual Box:

  • Target OS: Select Linux
  • Target OS version (target OS version): others
  • I have selected 1 GB memory and 1 CPU (other options retain default values)
  • Add a new hard disk: VDI drive, dynamic size, 512 M
  • In the storage option, add a CDROM pointing to the downloaded iso image.
3. Start Installation

Select install to hard disk from the boot menu (install to hard disk ).

Next, create a partition and select new, primary, bootable, and write to create a bootable primary partition.

Select yes in the next two steps. The second step is to enable GRUB management mode and can be used to debug programs.

2. Android-x86 has built-in shortcuts

Commonly used:

  • Alt-F1 = enter console mode
  • Alt-F7 = back to GUI Mode
  • Alt-F9 = graphic interface
  • Alt-F10 = image rotation 180 degrees
  • Alt-F10 = image rotation 180 degrees
  • Alt-F11 = rotate the screen 90 degrees left
  • Alt-F12 = rotating the screen 90 degrees to the right
  • Ctrl-P = Enable Android settings
  • The "Windows key" is equivalent to the Android Home button.
  • "Esc" is equivalent to the Android Back button
  • F2 is equivalent to the Menu button of Android
  • F3 is equivalent to the Android Search button
  • Menu key on the right (key in the middle of win and ctrl) = Android menu key
3. Set Virtual Machine network 1. vmware settings

A. nat mode is required for Virtual Machine installation.

B. If the/data/misc/dhcp directory does not exist, go to console mode to create

# mkdir /data/misc/dhcp

 

C. Shut down the Virtual Machine and vmware and modify the vmx file.

ethernet0.virtualDev = "vlance"

 

D. Enable the VM and enter console mode.

# su# dhcpcd eth0

 

E. Set the dns or the IP address consistent with the host's dns.

# setprop net.dns1 8.8.8.8
2. virtual box settings:

Use the Bridging Mode:

A. Run the netcfg command to check whether the eth0 device has assigned an IP address.

B. Enable the VM, use ALT + F1 to enter the console mode, and enter su to switch to the root user.

C. Specify the IP address and run the following script. The IP address must be in the same CIDR block as the physical host.

# ifconfig eth0 192.168.120.200 netmask 255.255.255.0 up

 

Add a physical host gateway to a route table

# route add default gw 192.168.120.254 dev eth0

 

D. Set the dns or the IP address consistent with the dns of the physical host, for example, 202.106.196.115.

# setprop net.dns1 8.8.8.8

 

In addition, if the pods and other processes are started, the network settings will fail. Using the netcfg command, you will find that there is no eth0 device.

Therefore, you must stop software such as pods before installing virtual machines.

If you use the NAT mode, you need to use dncpcd to automatically allocate IP addresses. The dns should be the same as the physical host, for example:

# dhcpcd# ifconfig eth0 up# setprop net.dns1 202.107.117.11

 

You also need to configure port forwarding.

You can also use the following command in the virtual box directory of the physical host for port forwarding:

# VBoxManage modifyvm "Your Android VB name" --natpf1 adb,tcp,*,5555,*,5555

 

3. Make the settings take effect for a long time

The configuration information in console mode does not seem to be saved. You can use the following methods to ensure that the configuration has always taken effect:

# Vi /etc/init.sh

 

Add the following configuration at the end of the file:

ifconfig eth0 192.168.120.200 netmask 255.255.255.0 uproute add default gw 192.168.120.254 dev eth0setprop net.dns1 202.106.196.115

 

4. Configure resolution to simulate mobile phone and tablet devices respectively

Virtual box can be used to configure resolution. vmware does not have a good solution yet. Therefore, Virtual box is used as an example.

1. Add custom resolutions to virtual machines

After the VM is shut down.

Method 1: open a new line under <ExtraData> In the vbox file of the corresponding virtual machine and add the following content

<ExtraDataItem name="CustomVideoMode1" value="480x800x16"/><ExtraDataItem name="CustomVideoMode2" value="320x480x16"/>

 

Method 2: run the command. Replace "VM name" with your own virtual machine name.

In dos mode, enter the VirtualBox installation directory. The default value is C: \ Program Files \ Oracle \ VirtualBox. Run the following command:

# VBoxManage setextradata "VM name" "CustomVideoMode1" "480x800x16"# VBoxManage setextradata "VM name" "CustomVideoMode2" "320x480x16"
2. Modify menu. lst of grub.

Start the VM and go to debug mode.

Re-mount partitions in RW Mode

# mount -o remount,rw /mnt

 

Edit file:

# vi /mnt/grub/menu.lst

 

For mobile phone resolution, copy the lines of MDPI, and for tablet resolution, copy the content of HDPI. Change the title to the name of the startup Item you want, such as "Android-x86 480X800x16", after "kernel" Add:

UVESA_MODE=480x800

 

The resolution of 320x480 is also similar.

3. Restart the Android-x86 in debug mode

Run commands

# /system/bin/reboot

 

You can.

5. Configure eclipse to allow remote debugging and development using virtual machines 1. Query IP addresses

Enter cosole mode and run netcfg or ip command to query the ip address of the VM:

Eth0 indicates the network device of the virtual machine, and the IP address is the IP address of the virtual machine.

2. Configure eclipse

Use Alt + F7 to return the graphic interface.

Open eclipse, go to the android development plug-in setting interface, select ddms, select Use ado host, and fill in the Virtual Machine IP address in the ADT host value column. For details, see:

 

Open the devices view. If the devices view is not loaded, use the following method to open the devices View:

 

In the devices view, Select Restart adb:

Alternatively, you can use the command line to restart adb. The new version of adb command is located in the platform-tools directory:

# adb kill-server# adb start-server

 

After restarting, you can see that the virtual machine devices are in the list.

3. Configure the run or debug parameters of the project.

When running or debugging a program, you can select a virtual machine as the debugging device.

If eclipse cannot find a virtual machine device, check whether the system has installed android connection programs such as pods. If installation is required, stop the related processes.

6. Configure the SD card

You can configure the SD card in multiple ways.

1. Disguise files as SD cards

Run the following script in console mode:

# dd if=/dev/zero of=/data/sdcard.img bs=1024 count=65536# losetup /dev/block/loop7 /data/sdcard.img# newfs_msdos /dev/block/loop7

 

65536 represents a 64 mb sd card. You can modify this number to increase the size of the SD card.

Restart the virtual machine to enter the debug mode and re-mount the partition in RW mode.

# mount -o remount,rw /mnt

 

Edit file:

# vi /mnt/grub/menu.lst

 

Add a parameter to the kernel:

SDCARD=/data/sdcard.img
2. Use independent partitions

Create a new hard disk in VirtualBox and assign it to the VM:

Start the VM in debug mode. The new partition is mounted to the/dev/sdb file by default.

You can query the partition information before creating a partition:

# fdisk -l /dev/sdb

 

Use fdisk to create a new partition. After the partition is created, format it:

# fdisk /dev/sdb

 

Subsequent operations of this command include the following parameters:

  • Enter m to display all commands.
  • Enter p to show hard disk segmentation.
  • Enter a to set the hard disk boot zone.
  • Enter n to set the new hard disk partition.
    • Enter the "e" hard drive as the [extended] partition (extend ).
    • Enter p hard drive as the [primary] partition (primary ).
  • Input t to change the partition property of the hard disk.
  • Enter d to delete the partition property of the hard disk.
  • The input q ends and is not saved to the hard disk partition.
  • Enter w and write it to the hard disk partition.

Enter n to create a partition.

 

Input p to create the primary Partition

 

This step asks about the partition serial number. Because sdb has no partition, you can select 1


Enter the starting block address. Default Value:

 

Sets the ending block address. This address determines the partition size. You can specify the total partition size and the number of Blocks provided here.

Enter w to write data to the partition and exit.

Use fat32 bit to format the partition:

# newfs_msdos /dev/sdb1

 

Edit the menu. lst file

# vi /mnt/grub/menu.lst

 

Add the kernel Parameter:

SDCARD=sdb1
7. Install the application 1. Install the application

If the device is not connected, you can use the following command to connect to the physical host in command line mode:

# adb connect 192.168.11.12

 

Run the following command to install apk:

# adb install -r HelloWorld.apk

 

But sometimes the following error is reported during installation:

More than one device and emulator

You can use the following method:

Find a device:

# adb devicesList of devices attachedemulator-5554   device

 

Install

# adb -s emulator-5554 install -r HelloWorld.apk

 

2. Uninstall
adb uninstall HelloWorld.apk

 

Or directly delete the file.

# adb -s emulator-5554 shell# cd /data/app# rm HelloWorld.apk# exit

 

Delete system applications:

Adb remount (re-mount the system partition to make the system partition writable ). Adb shellcd system/apprm *. apk

 

 

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.