自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
建立 Cuttlefish 混合式裝置
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明如何建立 Cuttlefish 混合裝置 (CHD)。
CHD 是一種混合型虛擬 Cuttlefish 裝置,會在裝置的 HAL 上執行實體裝置的系統映像檔,而非 Cuttlefish 系統映像檔。這項做法具備下列優點:
如要建立 CHD,請按照下列步驟操作:
使用 make dist
為 Cuttlefish 裝置和實體裝置產生目標檔案。
將兩個目標檔案合併為 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 圖片。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Create a Cuttlefish hybrid device\n\nThis page describes how to create a Cuttlefish hybrid device (CHD).\n\nA CHD is a hybrid virtual Cuttlefish device, which runs a physical device's\nsystem image instead of a Cuttlefish system image on the device's HALs. This\noffers the following advantages:\n\n- **Early development and testing:** CHDs allow for early development and\n testing of next-generation system software before the physical hardware is\n available.\n\n- **Scalability:** CHDs facilitate easier expansion of development and\n testing capacity.\n\nTo create a CHD, do the following:\n\n1. Generate the target files for the Cuttlefish device and the physical device\n using `make dist`.\n\n2. Combine the two target files into a CHD target file and generate the CHD\n images from the CHD target file by running the\n [`build_cf_hybrid_device.py`](https://cs.android.com/android/platform/superproject/+/android-latest-release:tools/treble/cuttlefish/build_cf_hybrid_device.py)\n script:\n\n python3 tools/treble/cuttlefish/build_cf_hybrid_device.py \\\n --framework_target_files_zip \u003cphysical_device_target_files.zip\u003e \\\n --vendor_target_files_zip \u003ccuttlefish_device_target_files.zip\u003e \\\n --otatools_zip \u003ccuttlefish_otatools.zip\u003e \\\n --target chd \\\n --output_dir \u003coutput_directory\u003e\n\n This script combines the two target files into a CHD target file using\n [`merge_target_files.py`](https://cs.android.com/android/platform/superproject/+/android-latest-release:build/make/tools/releasetools/merge/merge_target_files.py)\n and generates the CHD images from the CHD target file using\n [`img_from_target_files`](https://cs.android.com/android/platform/superproject/+/android-latest-release:build/make/tools/releasetools/img_from_target_files.py)."]]