This page explains how to download, build, and run AAOS SDV on Cuttlefish.
Get the AAOS SDV source code
Initialize and sync your AAOS SDV checkout using the android-latest-release
manifest branch:
repo init -u https://android.googlesource.com/platform/manifest -b android-latest-release
repo sync -c -j8A standard repo init command syncs all SDV repositories automatically. If you
filter manifest groups with -g, pass -g default,swcar. Don't pass -b main
on public AOSP because the public main branch omits SDV repositories. Whereas
-b android-latest-release tracks the latest public AOSP release, you can pin a
checkout to a specific release branch or tag (such as -b android17-release or
android-17.0.0_r1 for Android 17). For more
information, see Download the Android source and Code location.
Set up your build environment
From within your working directory, source the envsetup.sh script to set up
your build environment:
source build/envsetup.shThis script imports several commands that let you work with the Android source
code, including the commands used on this page. To view the source of the
script, see platform/build/envsetup.sh. To view the built-in help, type hmm.
Choose a target
Before building SDV, identify a target to build. To select your target, run
lunch followed by the product, release configuration, and build variant for
your release:
On Android 17 QPR2 and higher:
lunch aosp_cf_x86_64_sdv_core-aosp_current-userdebugOn Android 17:
lunch sdv_core_cf-aosp_current-userdebug
This command selects the product, release configuration, and variant to build and stores the selection in the environment.
lunch targets for SDV reside in the device/google/sdv and
device/google/sdv_display_safety directories. For target details, see
device/google/sdv/README.md. The following table lists the SDV lunch targets
by Android version:
| Target role | Android 17 QPR2 and higher | Android 17 | Description |
|---|---|---|---|
| SDV Core (x86-64) | aosp_cf_x86_64_sdv_core-aosp_current-userdebug |
sdv_core_cf-aosp_current-userdebug |
Base AAOS SDV Core image for x86-64 Cuttlefish
(sdv_core_cf is removed in
Android 17 QPR2).
|
| SDV Core (ARM64) | aosp_cf_arm64_sdv_core-aosp_current-userdebug |
sdv_core_arm64-aosp_current-userdebug |
AAOS SDV Core image for ARM64 Cuttlefish and hardware virtualization. |
| SDV Core performance and minimal variants |
aosp_cf_x86_64_sdv_core_perf-aosp_current-userdebug,aosp_cf_x86_64_sdv_core_tiny-aosp_current-userdebug
|
sdv_core_perf_cf-aosp_current-userdebug,sdv_core_tiny_cf-aosp_current-userdebug
|
Performance-tuned (omits sample bundles) and minimal-footprint x86-64 Cuttlefish targets. |
| SDV Media and HAR |
aosp_cf_x86_64_sdv_media-aosp_current-userdebug,aosp_cf_arm64_sdv_media-aosp_current-userdebug
|
sdv_media_cf-aosp_current-userdebug,sdv_media_har_cf-aosp_current-userdebug,sdv_media_arm64-aosp_current-userdebug,sdv_media_har_arm64-aosp_current-userdebug
|
AAOS SDV image with virtIO-virtualized media APIs and the high
availability renderer (HAR). In
Android 17 QPR2 and higher, HAR is unified
directly into sdv_media and starts automatically on boot.
|
| SDV IVI and Display Safety IVI |
aosp_cf_x86_64_auto_sdv-aosp_current-userdebug,aosp_cf_arm64_auto_sdv-aosp_current-userdebug( sdv_ivi_cf-aosp_current-userdebug and
sdv_ivi_arm64-aosp_current-userdebug are also supported in
Android 17 QPR2)
|
sdv_ivi_cf-aosp_current-userdebug,sdv_ivi_cf_ds-aosp_current-userdebug,sdv_ivi_arm64-aosp_current-userdebug,sdv_ivi_arm64_ds-aosp_current-userdebug
|
In-Vehicle Infotainment (IVI) image with SDV integration and sample
apps. In Android 17 QPR2 and higher,
aosp_cf_x86_64_auto_sdv and
aosp_cf_arm64_auto_sdv (and sdv_ivi_cf and
sdv_ivi_arm64 in Android 17 QPR2)
include Display Safety and ENABLE_SDV_INTEGRATION by
default (sdv_ivi_cf_ds is a deprecated wrapper, whereas
Android 17 requires
sdv_ivi_cf_ds for Display Safety).
|
Build AAOS SDV
Run the following command to build your target. Depending on the specification of your workstation, the first build takes between 30 and 60 minutes. Subsequent builds take significantly less time.
mAfter you build the full system image once, you can rebuild an individual Soong module or service bundle APEX without repackaging the entire image:
m <module_name>A targeted module build writes only that module's artifact under $OUT without
regenerating super.img or the partition images booted by Cuttlefish. To test
a rebuilt service bundle APEX on a running VM:
- On Android 17 QPR2 and higher: On
userdebugandengSDV Core builds, runadb root && adb remount -Ronce to enable writable overlays, push the rebuilt APEX file directly to/product/apex/, and runadb rebootto activate your changes without bumping the APEX version on every edit. - On Android 17 (and for staged OTA verification
on all releases): Increment
versioninapex_manifest.json, push the APEX file to/data/mydir/, and stage, activate, and commit the update withsdv_update_manager_client(or useadb install --stagedfor updatable APEXes onsdv_ivi_cf).
For more information, see Fast service bundle updates during development.
Build outputs appear in $OUT_DIR (out/ by default, with target partition
images in $OUT). If you build multiple VM targets from the same source
checkout, switching lunch targets in a shared out/ directory regenerates the
Soong build graph on each switch. To keep incremental builds fast across VMs,
open a separate terminal for each VM and re-export its OUT_DIR whenever you
open a new shell before initializing the build environment:
# Terminal 1 (SDV Core VM: use sdv_core_cf-aosp_current-userdebug on Android 17 (26Q2)) export OUT_DIR=out-sdv source build/envsetup.sh lunch aosp_cf_x86_64_sdv_core-aosp_current-userdebug# Terminal 2 (SDV IVI VM) export OUT_DIR=out-ivi source build/envsetup.sh lunch sdv_ivi_cf-aosp_current-userdebug
Test your build using Cuttlefish
After you build AAOS SDV, test your build using Cuttlefish.
To start Cuttlefish with your build:
cvd createCuttlefish runs using your built target (
aosp_cf_x86_64_sdv_core-aosp_current-userdebugon Android 17 QPR2 and higher, orsdv_core_cf-aosp_current-userdebugon Android 17). After Cuttlefish has booted, this message is displayed:VIRTUAL_DEVICE_BOOT_COMPLETED Virtual device booted successfullyRun
adbto connect to Cuttlefish.Run
adb devicesto verify that your build is running. A result similar to this is displayed:List of devices attached 0.0.0.0:6520 deviceRun
cvd stopto shut down the device. Becausecvd stopstops the VM immediately without a guest OS shutdown, runadb rebootfirst if you need to flush recent guest writes (such as staged APEX checkpoints) before stopping the device.To restart a stopped device while preserving its guest disk overlay and
/datastate (including staged service bundle APEX updates), run the start command that matches how you created the instance:cvd startforcvd create, orsdv-cf start --instance_name=instance1forsdv-cf create --instance_name=instance1(which replays the SDV bootconfig arguments). To restart a running device cleanly in place, runadb reboot. Runningcvd createorsdv-cf createlaunches a new instance group from the baseline partition images rather than resetting a stopped instance in place; to discard guest overlays and start clean, remove a stopped instance withcvd removebefore runningcvd create(or stop a running instance withcvd stop --clear_instance_dirsand resume it with the matching start command). For more information, see Cuttlefish: Restart and reset.
To run multiple instances of Cuttlefish with different builds, see Cuttlefish: Multi-tenancy.
Troubleshoot
This section explains how to troubleshoot errors that might occur during downloading, building, or running of AAOS SDV.
RBE errors
If you encounter any Remote Build Execution (RBE) errors, remove definitions of
USE_RBE and ENABLE_RBE_BOOTSTRAP from .bashrc or .zshrc.
cvd: VM manager crosvm isn't supported on this machine
If Cuttlefish reports that the VM manager crosvm isn't supported on your
machine, run the following command to install Cuttlefish:
sudo apt install cuttlefish-commoncvd not found
If you receive a cvd not found error:
- Set up your build again.
- Continue with Choose a target.
Cuttlefish crash loops
If Cuttlefish enters a crash loop:
- To stop all Cuttlefish instances, run
cvd stop. - Run
cvd start(orsdv-cf start --instance_name=instance1) to resume the existing instance. If corrupted guest disk state caused the crash loop, remove the stopped instance withcvd removebefore runningcvd create(orsdv-cf create --instance_name=instance1), or stop a running instance directly withcvd stop --clear_instance_dirsin the previous step and resume it withcvd start(orsdv-cf start --instance_name=instance1). For more information, see Test your build using Cuttlefish.