Android x86 on Hyper-V

来源:互联网 发布:围巾 淘宝店 知乎 编辑:程序博客网 时间:2024/06/08 07:00

Completing the series with the Part 2 of ‘How to install Android x86 4.4 RC2 on Hyper-V’.

On my last Post “How to install Android x86 on Hyper-V – Part 1: Install” we had:

– Phase 1: Download Android x86 4.3 and prepare a VM to run it
– Phase 2: Install Android x86 4.3 on a VM
– Phase 3: Run and Configure Android x86 for the first time

On this post I’ll cover:

– Phase 4: Run and Configure Android x86 for the first time
– Phase 5: Advanced settings – Screen resolution
– Phase 6: Advanced settings – Network configuration

 

Phase 4: Run and Configure Android x86 for the first time

When you boot the Android VM for the first time you need to configure the initial settings.

Before you start make sure you Eject the ISO image from the VM.

1. Ignore the Bluetooth warning and click “Ok” and select the preferred Language option “English United-States

boot

boot1

2. Ignore the Wifi Selection and click “Skip” and on the next screen confirm that by selecting “Skip anyway

boot2

boot3

3. If the Hyper-V vSwitch assigned to your Android VM is connected to the external network with Internet access and has a DHCP Server to assign IP Address configuration automatically you can choose “Yes” and accept the Terms to configure your Google account, if not click “No” to skip this.

boot4

4. Add your Google account sign in information.

boot5

5. On Google services click on the Down arrow and Right arrow afterwards.

boot6

6. You can skip the Payment info by clicking on “NOT NOW

boot7

7. On the Table info insert the desired name.

boot8

8. On the Welcome screen click “OK” and “OK” again

boot9

boot10

 

 

Phase 5: Advanced settings – Screen resolution

Android-x86 default config has been made for smaller form factors and screen resolutions, running it with the defaults on your VM environment is unpractical.

To change the screen resolution you need to accomplish the following:

– Determine what’s the best screen resolution for you
– Test the new screen resolution
– Make persistent changes of the new screen resolution
– Modify the font size of the Terminal Emulator

1. Determine what’s the best screen resolution for you

1.1  Start the VM and In the GRUB menu press the [a] key

1.2  In the next screen append vga=ask and press [Enter], on the next screen press [Enter] again

screen

You will be presented with the possible screen resolutions. Each resolution is defined by an hex value on the ‘Mode’ column (see below).

Example: 1024×768 16 bits has the hex value of ‘317’, however to use this screen resolution you need to convert the value from hex to decimal.

image

1.3 Determine what is your convenient Screen resolution through the following table, on the Mode Decimal column you have the appropriate value that you’ll use on testing and configuration.

Mode (hex):Mode DecimalResolutionTypeMode (hex):Mode DecimalResolutionTypeF00384080×25VGAF01384180×50VGAF02384280×43VGAF03384380×28VGAF05384580×30VGAF06384680×34VGAF07384780×60VGA300768640x400x8VESA301769640x480x8VESA311785640x480x16VESA312786640x480x32VESA326806800x512x8VESA327807800x512x16VESA328808800x512x32VESA303771800x600x8VESA314788800x600x16VESA315789800x600x32VESA329809896x600x8VESA32A810896x600x16VESA32B811896x600x32VESA3057731024x768x8VESA3177911024x768x16VESA3187921024x768x32VESA31D7971024x768x8VESA32C8121152x768x8VESA32D8131152x768x16VESA32E8141152x768x32VESA3077751280x1024x8VESA31A7941280x1024x16VESA3248041600x1024x8VESA3258051600x1024x16VESA3208001600x1200x8VESA3228021600x1200x16VESA    

2. Test the new screen resolution

I recommend that you test the screen resolution before you do the permanent changes. Example with a screen resolution of 1024x768x16 the configuration decimal value is ‘791’.

2.1 Start the VM and In the GRUB menu press the [a] key

2.2  In the next screen append vga=791 and press [Enter]

Android VM will start with the screen resolution of 1024×768 16 bits, if this is not the best configuration for yourself you can repeat the process with other resolution decimal value.

3. Make persistent changes of the new screen resolution

We will make persistent changes for screen resolution through GRUB, for that we need to mount the image and edit the ‘menu.lst’.

3.1 Start the Android VM and from the GRUB menu select ‘Debug Mode

3.2 Type the following to mount the image and edit GRUB ‘menu.lst’:

# mount -o remount,rw /mnt
# cd /mnt/grub
# vi menu.lst

screen1

3.3. Modify the GRUB menu boot option (menu.lst) with the appropriate screen resolution

For that you need to append to the identified line on the image below the value ‘vga=791’ (hex value would be 317 for the screen resolution 1024x768x16):

screen2

We will be using the ancient Unix editor Vi (http://www.cs.rit.edu/~cslab/vi.html), if you are not familiar you should know that editing a file with Vi is not as simple as Windows Notepad or other Linux editors (e.g. nano), so please do the following:

– Move the cursor to the start of the line mentioned on the above image

– Press the keys [SHIFT] + [A} to start the file editing mode

– Append ‘vga=791’ to the end of that line, you should end up with something like this (single line):

kernel /android-4.4-RC2/kernel root=/dev/ram0 androidboot.hardware=android_x86 video=-16 SRC=/android-4.4-RC2 vga=791

- When finished press the [ESC] key to exit the edit mode

- Save changes and quit with ‘:wq

Tip: Typing ‘:q’ woucd ld quit if no changes were done, ‘:q!’ would quit and discard any changes.

3.4 Unmount the image and reboot:

cd /
umount /mnt
reboot -f

On the next boot you will have the new screen resolution set.

4. Modify the Font size on the Terminal emulator

If you open the Terminal Emulator on it’s default font size you will get a very tiny Font size and you can barely read anything, so let’s adjust this.

4.1 Start your Android x86 VM, unlock the screen, click on the Apps button and open the “Terminal Emulator” on the Apps menu

settings

settings1

4.2 Click on the Top right button to slide down the menu options and select ‘Preferences

settings2

4.3 On the ‘Preferences’ screen click on ‘Font size

settings3

4.4 Now select your preferred Font size (reasonable size would be between 12 – 16pt) and clock on the Back button (bottom left) to return to the Terminal screen with the newer font size

settings4

 

Phase 6: Advanced settings – Network configuration

You can configure Android x86 network automatically through DHCP or manually. Manual network configuration will disappear every time you reboot Android x86 and you’ll need to repeat the network configuration. Due to this limitation I recommend that you configure Android x86 network settings automatically through DHCP.

To configure my network I can chose one of the following options:

– Automatic Network configuration through DHCP
– Manual Network configuration through terminal

 

For your better understanding I will use this network settings during the Terminal configuration:

IP: 192.168.1.20
Netmask: 255.255.255.0
Gateway: 192.168.1.1
DNS: 192.168.1.1

1. Automatic Network configuration through DHCP

If you have a DHCP Server on the same Network as your Android x86 the network settings should be set automatically.

1.1 Start your Android x86 VM, unlock the screen, click on the Apps button and open the “Terminal Emulator” on the Apps menu

settings

settings1

1.2 Verify your Network configuration settings

On Terminal run the following to verify your network settings:

ip a

image

You can also use netcfg to verify the NIC (eth0) state:

netcfg

image

Note: I’ve seen some situations where particular
routers (e.g. Linksys with dd-wrt firmwares) send invalid UDP packets and the Android x86 can’t pick the IP Address configuration. If that’s the case you can try the following in Terminal, if this either fails you need to connect to a different DHCP Server source or define your Network Settings manually.

adb shell
su
dhcpcd -k eth0                –> Release
dhcpcd -n eth0                –> Renew

2. Manual Network configuration through terminal

On Terminal run the following to configure your network settings:

adb shell
su

ifconfig eth0 192.168.1.20 netmask 255.255.255.0 up
route add default gw 192.168.1.1 dev eth0
setprop net.dns1 192.168.1.1

We had to use the Android Debug Bridge (adb) to allow you to communicate with Emulator, enable root access (su),  only after this you can configure your IP Address/netmask (ifconfig), default gateway (routeadd) and dns (setprop).

Verify your networking settings with:

ip a

image

Android x86 does not support ethernet persistent network settings, after reboot you need to run the same terminal commands to configure your machine.

0 0