Create a Cuttlefish hybrid device

This page describes how to create a Cuttlefish hybrid device (CHD).

A CHD is a hybrid virtual Cuttlefish device, which runs a physical device's system image instead of a Cuttlefish system image on the device's HALs. This offers the following advantages:

  • Early development and testing: CHDs allow for early development and testing of next-generation system software before the physical hardware is available.

  • Scalability: CHDs facilitate easier expansion of development and testing capacity.

Create a CHD image

To create a CHD image, follow these steps:

  1. Generate the target files for the vendor target and the physical device using make dist. Generate the vendor target files using one of the following options:

  2. Combine the two target files into a CHD target file and generate the CHD images from the CHD target file by running the build_cf_hybrid_device.py script. This script combines the two target files into a CHD target file using merge_target_files.py and generates the CHD images from the CHD target file using img_from_target_files.

    python3 tools/treble/cuttlefish/build_cf_hybrid_device.py \
      --framework_target_files_zip <physical_device_target_files.zip> \
      --vendor_target_files_zip <cuttlefish_device_target_files.zip> \
      --otatools_zip <cuttlefish_otatools.zip> \
      --target chd \
      --output_dir <output_directory>
    

Create a Cuttlefish vendor target

To create a Cuttlefish vendor-only target, follow these steps:

You can use aosp_cf_vendor.mk to define the aosp_cf_arm64_phone_vendor target, which you can use as the vendor target file for a CHD image.

  1. Inherit the Cuttlefish target that builds full artifacts.

    $(call inherit-product, device/google/cuttlefish/vsoc_arm64/phone/aosp_cf.mk)
    
  2. Define the target name.

    PRODUCT_NAME := aosp_cf_arm64_phone_vendor
    
  3. Disable unnecessary builds from the full artifacts.

    PRODUCT_BUILD_SYSTEM_IMAGE := false
    PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
    PRODUCT_BUILD_PRODUCT_IMAGE := false
    PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
    PRODUCT_BUILD_SUPER_PARTITION := false
    TARGET_SKIP_OTA_PACKAGE := true