Android x86: How to change the screen orientation to portrait orientation in VirtualBox

This was definitely trickier than expected! There are two things you need to do. First is to create the resolution, second is to edit the grub file.

Create the resolution

Open up command prompt and type in:

cd /d %PROGRAMFILES%\VirtualBox\
vboxmanage setextradata "Android 2.3" "CustomVideoMode1" "320x480x16"

This creates an extra resolution for your Android X86 virtual machine (replace "Android 2.3" with whatever your one is called). Of course, you can replace the resolution with whatever you want to.

Now fire up the VM. Once it loads up to the lock screen (you don't have to swipe to unlock):

  • Press Alt+F1 to enter the terminal
  • Type "su"
  • mkdir /data/fs
  • mount -t ext3 /dev/block/sda1 /data/fs
  • vi /data/fs/grub/menu.lst
  • Find the menu item you want by scanning the titles. I wanted to work on MDPI so I chose the second menu item.
  • On the line starting with "kernel", go to the end and press "i" to begin editing (yes, vi has some crazy conventions)
  • Change DPI=160 and vga=ask
  • (You can also take this chance to edit your default item to load. It's 0-based indexes)
  • Press escape to edit editing mode
  • Without the quotes, press ":wq" to save and quit (yeah, even more crazy vi conventions)

Restart your VM. When it boots, it'll give you an option to press enter to see video modes.

Take note of the "mode" next to your resolution. For me "320x480x16" was "360" (bottom left). Type in 360 and continue loading.

Android 2

This bit took me a while to figure out, but "360" is a hex value and you'll have to convert it value to a decimal first. In this case, 360 hex is 864 in decimal value.

Time to edit the file in vi again.

  • alt+f1 again to get into the console
  • mount -t ext3 /dev/block/sda1 /data/fs
  • vi /data/fs/grub/menu.lst
  • Change vga=ask to vga=864 (or whatever your decimal VGA mode is)
  • :wq to save
  • Reboot

Android 2
You should now see this wonderful phone sized emulator on your screen.


Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog