• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Custom VM
2
3## Headless VMs
4
5If your VM is headless (i.e. console in/out is the primary way of interacting
6with it), you can spawn it by passing a JSON config file to the
7VirtualizationService via the `vm` tool on a rooted AVF-enabled device. If your
8device is attached over ADB, you can run:
9
10```shell
11cat > vm_config.json <<EOF
12{
13  "kernel": "/data/local/tmp/kernel",
14  "initrd": "/data/local/tmp/ramdisk",
15  "params": "rdinit=/bin/init"
16}
17EOF
18adb root
19adb push <kernel> /data/local/tmp/kernel
20adb push <ramdisk> /data/local/tmp/ramdisk
21adb push vm_config.json /data/local/tmp/vm_config.json
22adb shell "/apex/com.android.virt/bin/vm run /data/local/tmp/vm_config.json"
23```
24
25The `vm` command also has other subcommands for debugging; run
26`/apex/com.android.virt/bin/vm help` for details.
27
28# Terminal app
29## Run GUI apps
30Execute `source enable_display` and then click Display button above to enable display feature.
31And then, go back to the terminal, and run GUI apps.
32
33## Hardware acceleration
34If the file `/sdcard/linux/virglrenderer` exists on the device, it enables VirGL for VM.
35This requires enabling ANGLE for the Terminal app. (https://chromium.googlesource.com/angle/angle.git/+/HEAD/doc/DevSetupAndroid.md)
36