0

I installed vmlite's android image which is great but there is one thing I don't find solution: How to change the screen size?

It has a fix ratio of the width/height of the screen, but I need to change it to simulate some android phones.

I searched a lot but not find a solution, please help.


UPDATE

The grub menu is as following:

  1. cmdline (hd0,2)/cmdline
  2. kernel --use-cmd-line (hd0,2)/kernel
  3. initrd (hd0,2)/ramdisk

I haved add a custom size using this command:

VBoxManage.exe setextradata "android-vmlite" "CustomVideoMode1" "480x800x32"

Then add vga-ask to all of the 3 menu options, but none works.

When press b on them, it doesn't ask to choose model.

Freewind
  • 193,756
  • 157
  • 432
  • 708

2 Answers2

1

Ok, I've done some research and finally was able to edit the virtual box image. Here's how:

If you go to vmlite image's grub entries on boot , the kernel entry (one with "kernel" keyword) has an argument --use-cmd-line , this cmdline is defined in the first entry cmdline (hd0,2)/cmdline, which is a file called cmdline placed inside boot hard disk's third partition.

This file has the kernel options:

init=/init qemu=1 console=ttyS0 console=tty0 vga=788 verbose androidboot.hardware=vbox_x86 androidboot.console=ttyS0 android.qemud=ttyS1

Now you must edit this file called cmdline to change vga=788 option to vga=ask.

Editing: (on a Linux machine)

You need to install vdfuse.

sudo apt-get install virtualbox-fuse

create two empty folders somewhere.

sudo mkdir /mnt/image

sudo mkdir /mnt/partition

Then mount the virtual box image (vdi, vmdk or vhd etc) to a folder. (Lets say virtualbox disk image file is /tmp/vmlite.vmdk and we'll mount it to /mnt/image folder)

vdfuse -w -f /tmp/vmlite.vmdk /mnt/image

Some files will be created in mount folder named EntireDisk, Partition1 , Partition2, Partition3 and so on.

since we are interested in third partition, we will mount the corresponding file to /mnt/partition:

sudo mount -o loop /mnt/image/Partition3 /mnt/partition

See the contents:

sudo ls -l /mnt/partition

There'd be cmdline, ramdisk and kernel.

Now we edit the cmdline file (we'll use gedit text editor, you can use one you like):

sudo gedit /mnt/partiton/cmdline

make the edits, change vga=788 to vga=ask, save and close. Verify new file contents:

sudo cat /mnt/partition/cmdline

Unmount files and images:

sudo umount /mnt/partition

sudo umount /mnt/image

and if we don't need those two folders:

sudo rm /mnt/image

sudo rm /mnt/partition

Done, boot image from virtual box. It'll say press ENTER to view available video modes, On Enter a list is shown, type the digit of choice, or type "scan" to search for more display modes.

NOTE: Not all modes worked ,use VESA modes with color depth 24 or 32 and supported aspect ratios.

Community
  • 1
  • 1
S.D.
  • 29,290
  • 3
  • 79
  • 130
  • Thanks again, it works great! Now I can set the screen to 480x800x32 and 800x1280x32 :) The only strange thing is the color of my application is changed, seems 8bit or 16bit, not as beautiful as before. – Freewind Sep 22 '12 at 15:58
  • The problem is fixed when I change my custom color depth to 16: `800x1280x16` :) – Freewind Sep 22 '12 at 15:59
  • I can't stop myself to thank you again :) You saved me a lot of time! – Freewind Sep 22 '12 at 16:06
  • 16 bit works ? not on my machine though. I'm glad I could help. :) – S.D. Sep 23 '12 at 07:36
0

please refer to this thread:

http://forum.xda-developers.com/showthread.php?p=19785371

You can change this file, cmdline, inside (hd0,2)

init=/init qemu=1 console=ttyS0 console=tty0 vga=788 verbose androidboot.hardware=vbox_x86 androidboot.console=ttyS0 android.qemud=ttyS1

==>

init=/init qemu=1 console=ttyS0 console=tty0 vga=ask verbose androidboot.hardware=vbox_x86 androidboot.console=ttyS0 android.qemud=ttyS1

Thank wingman for his detailed instructions.

Another option is to attach the vmdk file to a running linux vm (if you have one), the disk would auto mount to make life simpler.

huisinro
  • 1,083
  • 10
  • 15
  • did you modify cmdline file? I just tested, it will display a list of resolutions, press Space bar – huisinro Sep 20 '12 at 03:51
  • Are you using vmlite android image: http://www.vmlite.com/index.php?option=com_content&view=article&id=69&Itemid=178 ? – Freewind Sep 20 '12 at 04:54
  • 1
    yes, I am the author of that vm, will release jelly bean vm next month, most likely – huisinro Sep 21 '12 at 06:01
  • Nice to see you and thanks for your great work, it saved me ton of time. Hope it support defining custom screen size easily in the next release :) – Freewind Sep 21 '12 at 06:12