0

Androidx86.org says that to use 3d acceleration for my androidx86 virtual machine i have to install Linux guest additions.I would like to know how to do that.

I am using a

  • ubuntu 20.10 (64bit)
  • core i5 4th gen(@3.1 ghz)
  • Nvidia gt 730
  • Virtualbox 6.1
2
  • I don't think the guest additions that come with VirtualBox can be installed on Android-x86, the list of supported OS can be seen here: virtualbox.org/manual/ch04.html#additions-linux Therefore you would have to compile a custom kernel(module) android-x86.org/documentation/customize_kernel.html In my opinion you should just start with VBoxVGA VM setting.
    – Robert
    Nov 16 '20 at 17:21
  • @Robert The vm does not perform well without 3d acceleration.I would like to know how to customise the kernel to include vbox guest os integrations.Or obtain a prebuilt image Nov 17 '20 at 3:36
2

To use GPU acceleration for android x86 vm it's easier if you use qemu.Check this out(the method i used and this video are not fully same.i used the latest version)

Linux exclusive-Feel free to comment your questions

  • Install the following build dependencies(no need to build for arch linux read below) usingsudo apt install -y build-essential libepoxy-dev libdrm-dev libgbm-dev libx11-dev libvirglrenderer-dev libpulse-dev libsdl2-dev libgtk-3-dev libsdl1.2-dev ninja-build
  • cd into directory you want to download and build qemu(if you use arch linux you don't have to build qemu.just use the package in official repository.also it is not necessary to add your user to kvm group.it just works.)
  • Download latest qemu sources using git clone https://git.qemu.org/git/qemu.git
  • run cd qemu
  • run ./configure --enable-sdl --enable-opengl --enable-virglrenderer --enable-system --enable-modules --audio-drv-list=pa --target-list=x86_64-softmmu --enable-kvm --enable-gtk
  • run make
  • run sudo adduser yourusername kvm
  • run sudo chmod 666 /dev/kvm
  • run sudo touch /lib/udev/rules.d/99-kvm.rules
  • add line KERNEL=="kvm", GROUP="kvm", MODE="0666" to 99-kvm.rules
  • you can do that by sudo gedit /lib/udev/rules.d/99-kvm.rules and pasting the line then saving.
  • run sudo apt install qemu-utils
  • cd to the directory where you want create the virtual hard disk.
  • qemu-img create -f qcow2 Android.img 10G
  • 10G refers to size of hard disk drive,in this case 10 Gigabytes.
  • Download androidx89.(latest kernel version performed better for me or was it just a placebo?)
  • cd to directory were u git cloned qemu
  • cd to directory qemu/build/x86_64-softmmu/ ie cd qemu/build/x86_64-softmmu/
  • run
qemu-system-x86_64 -boot d \
    -enable-kvm \
    -smp 2 \
    -cdrom "/path/to/android/iso" \
    -name linuz \
    -device virtio-vga,virgl=on,xres=1280,yres=720 \
    -cpu host \
    -device AC97 \
    -m 2048 \
    -display sdl,gl=on \
    -drive file=/path/to/android/Android.img,if=virtio \
    -object rng-random,id=rng0,filename=/dev/urandom \
    -device virtio-rng-pci,rng=rng0 \
    -device virtio-keyboard \
    -boot menu=off \
    -device virtio-tablet \
    -machine type=q35 \
    -serial mon:stdio \
    -net nic -net user,hostfwd=tcp::4444-:5555
  • smp refers to number of cpu cores given to the virtual machine. -m refers to ram allocated.in this case 2048 megabytes.you can use -display gtk,gl=on also but display gtk does not work nvidia proprietary drivers for some reason.
  • Use arrow keys to navigate and enter to select.do as follows
  • Select Installation enter image description here
  • Select create/modify partition enter image description here
  • dont use gpt enter image description here
  • Select new
    enter image description here
  • select primary enter image description here
  • press enter enter image description here
  • select write and type yes .then select quit enter image description here
  • select the partition we just created enter image description here
  • select ext4 enter image description here
  • select yes to format enter image description here
  • select yes to install grub enter image description here
  • select yes to make /system read write (recommended) enter image description here
  • Once all operations are over u can boot into android.
  • To boot directly to hard disk use
qemu-system-x86_64 -boot c \
    -enable-kvm \
    -smp 2 \
    -name linuz \
    -device virtio-vga,virgl=on,xres=1280,yres=720 \
    -cpu host \
    -device AC97 \
    -m 2048 \
    -display sdl,gl=on \
    -drive file=/path/to/android/Android.img,if=virtio \
    -object rng-random,id=rng0,filename=/dev/urandom \
    -device virtio-rng-pci,rng=rng0 \
    -device virtio-keyboard \
    -boot menu=off \
    -device virtio-tablet \
    -machine type=q35 \
    -serial mon:stdio \
    -net nic -net user,hostfwd=tcp::4444-:5555
  • to use adb use adb connect localhost:4444
  • if arm translator does not install automatically do this

instructions to manually install native bridge

  • Download this file(http://dl.android-x86.org/houdini.php?v=9_y) in your vm.9 refers to android version if you have a previous version change it accordingly.or you can check it here

  • change the name of the file according to the version of android in my case houdini9_y.sfs.move that file to system/etc/ it can be done using terminal or root browser.

using terminal type mv /sdcard/Download/houdini9_y.sfs /system/etc if you are not comfortable with this method use a root browser app.

  • now got to terminal emulator type su (if you get a prompt asking weather to give superuser access say yes forever)
  • then type system/bin/enable_nativebridge
  • You might get some errors but they are safe to ignore i suppose.(i got two errors but arm translators worked)
  • Go to settings androidx86-options enable native bridge

Setting up tap networking
For better guest-host integrations i use a tap network.

sudo ip link add name br0 type bridge
sudo ip addr flush enp3s0
sudo ip link set enp3s0 master br0
sudo ip tuntap add mode tap name tap0 user yourusername
sudo ip link set tap0 master br0
sudo ip link set enp3s0 up
sudo ip link set tap0 up
sudo ip link set br0 up
sudo dhclient -v br0

replace enp3so with your network interface.use the following to command to launch the emulator

qemu-system-x86_64 -boot c \
    -enable-kvm \
    -smp 2 \
    -name linuz \
    -device virtio-vga,virgl=on,xres=1280,yres=720 \
    -cpu host \
    -device AC97 \
    -m 2048 \
    -display sdl,gl=on \
    -drive file=/path/to/imgfile,if=virtio \
    -object rng-random,id=rng0,filename=/dev/urandom \
    -device virtio-rng-pci,rng=rng0 \
    -device virtio-keyboard \
    -boot menu=off \
    -device virtio-tablet \
    -machine type=q35 \
    -serial mon:stdio \
    -netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no \
    -device virtio-net-pci,netdev=mynet0,mac=51:55:00:a1:11:32
2
  • Nice tutorial, but after compiling and configuration I always get this error > qemu-system-x86_64: -device virtio-vga,virgl=on,xres=1280,yres=720: > Property 'virtio-vga.virgl' not found" I'm on Debian 11. When I omit the virgl parameter it runs, however not sure if with 3d accel. Thanks
    – masscream
    Aug 20 at 8:21
  • @masscream Try virtio-vga-gl,xres=1280,yres=720 Oct 21 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.