Download, build, and run

This page explains how to download, build, and run AAOS SDV on Cuttlefish.

Initialize the Repo client

Set up your client to access the Android source repository:

  1. Create and navigate to a working directory, such as sdv:

    mkdir WORKING_DIRECTORY
    cd WORKING_DIRECTORY
  2. Initialize your working directory for source control:

    This example uses the branch 26Q2-fs-release.

    RELEASE=26Q2-fs-release
    repo init -u https://partner-android.googlesource.com/platform/vendor/pdk/generic/fs/manifest/ -b $RELEASE

    The -u option is required and identifies a manifest file, which is an XML file specifying where the various Git projects in the Android source are placed within your working directory. In this example, the name of the manifest file isn't specified, so the command uses the default manifest file (default.xml).

    The -b option identifies the branch you're initializing.

    The output should contain the message:

    repo has been initialized in path_to_working_directory

Download the AAOS SDV source

Run the following command to download the Android source tree to your working directory:

repo sync -c -j8

The -c argument instructs Repo to fetch the current manifest branch from the server. The -j8 command splits the sync across threads for faster completion.

Set up your build environment

From within your working directory, source the envsetup.sh script to set up your build environment:

source build/envsetup.sh

This 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 identify your target to build, use the lunch command followed by a string representing the target you're building for. For example, use this command to build a target for the Cuttlefish emulator:

lunch sdv_core_cf-trunk_staging-userdebug

This command selects the product, release configuration, and variant to build and stores the selection in the environment.

lunch targets for SDV are provided in a separate Git project located in the devices/google/sdv directory. See a detailed description of available targets at device/google/sdv/README.md. The main Cuttlefish (cf) targets are:

  • sdv_core_cf-trunk_staging-userdebug - Build an image of AAOS SDV Core (sdv_core) that runs on Cuttlefish (cf).
  • sdv_media_cf-trunk_staging-userdebug - Build an image of AAOS SDV Core with virtIO-virtualized media APIs (sdv_media).
  • sdv_media_har_cf-trunk_staging-userdebug - Build an image that extends the AAOS SDV media (sdv_media_cf) lunch target to contain the high-availability renderer (HAR). HAR runs automatically on boot.
  • sdv_ivi_cf-trunk_staging-userdebug - Build an image of In-Vehicle Infotainment (IVI) containing the SDV Gateway and Java sample apps.
  • sdv_ivi_cf_ds-trunk_staging-userdebug - Build an image that extends the AAOS SDV IVI target (sdv_ivi_cf) and includes Display Safety's DriverUI and Instrument Cluster implementation.

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.

m

The output of your build appears in $OUT_DIR. If you build different targets, each target build appears in $OUT_DIR.

Test your build using Cuttlefish

After you build AAOS SDV, test your build using Cuttlefish.

  1. To start Cuttlefish with your build:

    cvd create

    Cuttlefish runs using your built target (sdv_core_cf-trunk_staging-userdebug). After Cuttlefish has booted, this message is displayed:

    VIRTUAL_DEVICE_BOOT_COMPLETED
    Virtual device booted successfully
  2. Run adb to connect to Cuttlefish.

  3. Run adb devices to verify that your build is running. A result similar to this is displayed:

    List of devices attached
    0.0.0.0:6520 device
  4. Run cvd stop to shut down the device.

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-common

cvd not found

If you receive a cvd not found error:

  1. Set up your build again.
  2. Continue with Choose a target.

Cuttlefish crash loops

If Cuttlefish enters a crash loop:

  1. To stop all Cuttlefish instances, run cvd stop.
  2. Use Cuttlefish to retest your build.