Android Cuttlefish has made a lot of progress since last time I have messed with them (about 5, 6 years ago!) For example, arm64 host is now supported. WebRTC is finally working. However, certain things are still pretty hideous. Docs are scattered around. Info are hard to find. Simply running a CVD instance locally for dev purpose is very troublesome.
So I took some time and cooked a docker container that satisfy my heart. It basically wrap around cvd host tools and create a single CVD instance inside a container. All the plumbing is in place to make it easy and quick to run. I call it cuttlefish-host-container.
Below is a straight copy of the README.md file from the github project page.
cuttlefish-host-container
Docker container that runs Android cuttlefish emulators for x86_64, arm64, riscv64 guests
Background
I simply wanted to run RISC-V AOSP via cuttlefish on my laptop, and the journey wasn’t smooth.
- The info is scarce, broken and conflicting
https://github.com/google/android-riscv64 - Host machine becomes cluttered by packages, virtual devices and run-time artifacts
- The existing container-based solution by Google is overkill and not very user friendly
https://source.android.com/docs/devices/cuttlefish/on-premises
Goal
Simple container that runs one cuttlefish instance on an x86_64 Linux host. It can run the following guests:
- x86 guest via crosvm
- x86 guest via qemu
- arm64 guest via qemu
- riscv64 guest via qemu
Usage
Three steps to use the container:
- Build the docker image via
"docker build ..."(once) - Create or update the cvd instance via
"cf-init.sh ..."(infrequently)
- populate/update instance with aosp img zip and/or cvd host package
- Run the cvd instance via
"cf-run.sh"(frequently)
Below is a sample execution sequence:
docker build . -t cf-host
./cf-init.sh -P aosp_cf_x86_64_only_phone-img-14421689.zip -H cvd-host_package.tar.gz
# run with qemu
./cf-run.sh
gvncviewer localhost
# or run with crosvm, much faster
./cf-run.sh -- -e CF_VM_MANAGER=crosvm -e CF_START_WEBRTC=true
firefox https://localhost:8443
You can find the product img zip file and cvd host package at here:
Or build them from your own aosp tree:
source build/envsetup.sh
lunch aosp_cf_x86_64_only_phone-aosp_current-userdebug
m dist
# packages are in $(ANDROID_ROOT)/out/dist/
Additional notes:
- run
cf-init.sh -handcf-run.sh -hfor more info - create multiple containers/instances by creating multiple directories. Example:
mkdir riscv; cd riscv; ../cf-init.sh ...; ../cf-run.sh- However, only one instance can run at a time due to port conflicts.
- ADB & VNC ports are visible to the LAN. You can run on a headless server.
TODO
- GPU acceleration does not work yet
