...
The launch_cvd
command rus two commands assemble_cvd
and run_cvd
in its child processes. If both commands work as expected, the Android can launch successfully on Cuttlefish machine. The assemble_cvd
command generates root file system images with overlay / qcow2 overlay format, then the run_cvd
command invokes the virtual machine manager (either Crosvm or QEMU) to boot the virtual machine with the generated images on virtual machine. The diagram below shows the Cuttlefish flow.
...
Using assemble_cvd
Let’s we assume we work on TRS and want to run Android Automotive OS on Xen virtual machine, in this case, it’s likely we cannot directly use launch_cvd
command for launching Xen virtual machine. Then Therefore, we need to use assumble_cvd
command to help us to generate file system images, and afterwards we can execute QEMU command to launch Xen virtual machine. This is why we need to understand how to use assumble_cvd
command.
...
Code Block |
---|
HOME=$PWD ./bin/assemble_cvd --group_id=cvd_1 --report_anonymous_usage_stats=y --vm_manager=qemu_cli --webrtc_device_id=cvd_1-1 --gpu_mode=drm_virgl |
Then we can use the to launch the shell script with below command. This command can help use to close closes stdin and direct directs the stdout to the pipe :
...
for workaround the failure mentioned above:
Code Block |
---|
true | sh test.sh 2>&1 | cat |
Note, as you have noticed that we can pass most launch_cvd
’s parameters to assemble_cvd
, but it is not always true that these two commands can support exact same parameters. If you want to check what’s the parameters passed to assemble_cvd
, you can firstly run launch_cvd
and after assumble_cvd
is launched in the sub process, you can check the parameters for the assumble_cvd
process:
Code Block |
---|
$ ps -e | grep assemble_cvd
673381 ? 00:00:02 assemble_cvd
$ cat /proc/673381/cmdline | sed -e "s/\x00/ /g"; echo
/home/leoy/Dev2/aosp_cuttlefish_test/cf/bin/assemble_cvd --group_id=cvd_1 --report_anonymous_usage_stats=y --vm_manager=qemu_cli --webrtc_device_id=cvd_1-1 |
The Android images
Using above command, the two prebuilt Android images are shared in:
cuttlefish_drm_virgl_venus.tgz : Android automotive images with GPU mode drm_virgl
for venus
cuttlefish_gfxstream.tgz : Android automotive images with GPU mode gfxstream
for vulkan.
Download the package and uncompress it in the folder /home/leoy/Dev2/aosp_cuttlefish_test/cf
to ensure all linkages work well.
Using run_cvd
Same as the assemble_cvd
command, it prevents we are prevent to directly run the run_cvd
command. If we want to directly execute it, we can use the command:
Code Block |
---|
$ true | HOME=$PWD ./bin/run_cvd 2>&1 | cat |
run_cvd
manages dozen of backend programs internally for emulating virtual devices (e.g. for WiFi, secure devices, etc). For the rough brief understanding of the run_cvd
’s internal, you could refer to below diagram:
...
-bios /home/leoy/Dev2/aosp_cuttlefish_test/cf/etc/bootloader_x86_64/bootloader.qemu
: Enable bootloader (U-boot). (Needed by Xen)
Suggested QEMU command for Xen virtual machine
Below is the suggested command for running Android image on Xen virtual machine. It has not been tested yet. Once we have hardware is avaliable for the testing, we might update below arguments.
Code Block |
---|
$ /usr/bin/qemu-system-aarch64 -xen-domid 1 -no-shutdown -chardev socket,id=xen-cmd,path=/var/run/xen/qmp-libxl-1,server=on,wait=off -mon chardev=xen-cmd,mode=control -nodefaults -no-user-config -xen-attach -name aaos-vm -vnc none -display sdl,gl=on -device pcie-pci-bridge,id=hvc-bridge,addr=01.2 -device virtio-gpu-gl-pci,id=gpu0,xres=720,yres=1280 -device virtio-mouse-pci,disable-legacy=on,iommu_platform=on -device virtio-keyboard-pci,disable-legacy=on,iommu_platform=on -smp 4,maxcpus=4 -machine xenpvh -m 6144 -chardev file,id=serial0,path=/path/to/kernel-log-pipe,append=on -serial chardev:serial0 -chardev file,id=hvc0,path=/path/to/kernel-log-pipe,append=on -device virtio-serial-pci-non-transitional,max_ports=1,id=virtio-serial0,bus=hvc-bridge,addr=01 -device virtconsole,bus=virtio-serial0.0,chardev=hvc0 -drive file=/path/to/overlay.img,if=none,id=drive-virtio-disk0,aio=threads -device virtio-blk-pci-non-transitional,scsi=off,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive file=/path/to/persistent_composite_overlay.img,if=none,id=drive-virtio-disk1,aio=threads -device virtio-blk-pci-non-transitional,scsi=off,drive=drive-virtio-disk1,id=virtio-disk1 -drive file=/path/to/sdcard_overlay.img,if=none,id=drive-virtio-disk2,aio=threads -device virtio-blk-pci-non-transitional,scsi=off,drive=drive-virtio-disk2,id=virtio-disk2 -object memory-backend-file,id=objpmem0,share=on,mem-path=/path/to/pstore,size=2097152 -device nvdimm,memdev=objpmem0,id=ramoops -object rng-random,id=objrng0,filename=/dev/urandom -device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,max-bytes=1024,period=2000 -netdev tap,id=hostnet0,ifname=cvd-mtap-01,script=no,downscript=no -netdev tap,id=hostnet1,ifname=cvd-etap-01,script=no,downscript=no -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,mac=00:1a:11:e0:cf:00 -device virtio-net-pci-non-transitional,netdev=hostnet1,id=net1,mac=00:1a:11:e1:cf:00 -bios /path/to/u-boot.bin |