建立 Cuttlefish 混合式裝置

本頁說明如何建立 Cuttlefish 混合式裝置 (CHD)。

CHD 是混合式虛擬 Cuttlefish 裝置,會在裝置的 HAL 上執行實體裝置的系統映像檔,而非 Cuttlefish 系統映像檔。這項機制有以下好處:

  • 早期開發和測試:在實體硬體推出前,即可使用 CHD 進行新一代系統軟體的早期開發和測試。

  • 擴充性:CHD 可簡化開發和測試容量的擴充作業。

如要建立 CHD,請執行下列步驟:

  1. 使用 make dist 為 Cuttlefish 裝置和實體裝置產生目標檔案。

  2. 將這兩個目標檔案合併為一個 CHD 目標檔案,然後執行 build_cf_hybrid_device.py 指令碼,從 CHD 目標檔案產生 CHD 映像檔:

    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>
    

    這項指令碼會使用 merge_target_files.py 將兩個目標檔案合併為一個 CHD 目標檔案,並使用 img_from_target_files 從 CHD 目標檔案產生 CHD 圖片。