crosvm can be used to run a blazing fast Android VM on a Linux host with GPU acceleration, negligible overhead and close to native performance.
The Android window feels smoother than ever before.
It can configured to use udmabuf, minigbm and wayland for a incredibly efficient rendering pipeline with zero copy display from guest to host wayland server.
It doesn’t work as expected out of the box, so we will have to apply some patches to fix mouse input.
The executable will be in ./target/release/crosvm
Remove the CROSVM_USE_SYSTEM_VIRGLRENDERER=1 CROSVM_USE_SYSTEM_MINIGBM=1 flags if build fails or you are using an ancient linux distro with older versions of libgbm or virglrenderer.
It cannot render to screen without using the right gralloc/hwc options.
The android.img was prepared using the script.
Add SETUPWIZARD=0 to kernel parameters (—params ”..”) to bypass Android setup wizard.
Add --net tap-name=crosvm_tap to the crosvm cmdline.
A static IP configuration is required inside the Android VM to connect to the network. However Android does not have settings to configure static IP for ethernet connections. We can use VirtWifi feature of Android-x86 as a workaround.
Add VIRT_WIFI=1 to kernel cmdline parameters to enable this feature.
Then connect to VirtWifi network from Android settings. Select Static IP and set IP Address to 192.168.10.2 and gateway to 192.168.10.1
Troubleshooting
Colors are inverted: Turn on invert colors in Android Settings > Accessibility as a workaround or compile minigbm and virglrenderer with minigbm allocation enabled and link with crosvm binary.
crosvm crashes with virtio-gpu error: Remove udmabuf=true from crosvm cmdline, udmabuf is not supported by all GPUs.
Venus Vulkan driver
After applying the following patch, the embedded virglrenderer library is compiled with minigbm allocation. This is required on the host for venus.
Patching virglrenderer source is also required to link against libminigbm built by cargo.
Add vulkan=true to the list of comma separated gpu flags in crosvm cmdline.
virtiofs shared /data
Add --shared-dir "/absolute/path/to/bliss/data:data:type=fs:cache=always" to the crosvm cmdline.
Add DATA=virtiofs to kernel cmdline parameters.
Enable serial console
Add androidboot.enable_console=1 to kernel cmdline parameters.
For reference
crosvm command lines extracted from certain versions of Google products.