自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
開發 Android 核心
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明如何在 Cuttlefish 裝置上開發 Android 核心。
支援的核心資訊清單
Cuttlefish 在 Android 最新版本分支和 AOSP GSI 版本中支援下列核心資訊清單。
android-latest-release
android-15.0.0_r36
common-android16-6.12
common-android15-6.6
common-android14-6.1
common-android14-5.15
aosp-android13-gsi
common-android13-5.15
common-android13-5.10
aosp-android12-gsi
common-android12-5.10
common-android12-5.4
common-android-4.19-stable
aosp-android11-gsi
common-android11-5.4
common-android-4.19-stable
common-android-4.14-stable
以下是 Cuttlefish 裝置的核心開發來源。
開發 Android 核心
如要在 Cuttlefish 裝置上開發核心,請按照下列步驟操作:
為 Cuttlefish 裝置複製適當的核心 repo 資訊清單,然後進行任何變更。
mkdir common-android-mainline
cd common-android-mainline
repo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainline
repo sync -c -j$(nproc) -q
建構核心和 RAM 磁碟。詳情請參閱「為虛擬裝置建構供應商模組」。
tools/bazel run //common-modules/virtual-device:virtual_device_x86_64_dist
如果使用 common-android-4.19-stable
、common-android-4.14-stable
或 common-android11-5.4
核心資訊清單,請執行:
BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh && BUILD_CONFIG=common-modules/virtual-device/build.config.cuttlefish.x86_64 build/build.sh
您可以前往 ci.android.com 下載相關構件,而非在本機建構 (以免下載核心來源並設定核心開發環境)。
使用 Cuttlefish 啟動核心和 RAM 磁碟。
cvd create \
-kernel_path=./out/virtual_device_x86_64/dist/bzImage \
-initramfs_path=./out/virtual_device_x86_64/dist/initramfs.img
如果要啟動非 GKI 核心 (4.19 以下的任何版本),請省略 -initramfs_path
引數。
如果您要在 aarch64 版本的 Cuttlefish 上啟動核心,請使用 aarch64
建構設定,並使用 Image
構件,而非 bzImage
。
cvd create \
-kernel_path=./out/virtual_device_aarch64/dist/Image \
-initramfs_path=./out/virtual_device_aarch64/dist/initramfs.img
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Develop Android kernels\n\n\u003cbr /\u003e\n\nThis page describes how to develop Android kernels on Cuttlefish devices.\n\nSupported kernel manifests\n--------------------------\n\nCuttlefish supports the following kernel manifests on\nthe Android latest release branch and AOSP GSI releases.\n\n- On `android-latest-release`\n - `common-android-mainline`\n- On `android-15.0.0_r36`\n - `common-android16-6.12`\n - `common-android15-6.6`\n - `common-android14-6.1`\n - `common-android14-5.15`\n- On `aosp-android13-gsi`\n - `common-android13-5.15`\n - `common-android13-5.10`\n- On `aosp-android12-gsi`\n - `common-android12-5.10`\n - `common-android12-5.4`\n - `common-android-4.19-stable`\n- On `aosp-android11-gsi`\n - `common-android11-5.4`\n - `common-android-4.19-stable`\n - `common-android-4.14-stable`\n\nThe following are kernel sources for kernel development on Cuttlefish devices.\n\n- [`kernel/common-android-mainline`](https://cs.android.com/android/kernel/superproject/+/common-android-mainline:)\n- [`kernel/common-android16-6.12`](https://cs.android.com/android/kernel/superproject/+/common-android16-6.12:)\n- [`kernel/common-android15-6.6`](https://cs.android.com/android/kernel/superproject/+/common-android15-6.6:)\n- [`kernel/common-android14-6.1`](https://cs.android.com/android/kernel/superproject/+/common-android14-6.1:)\n- [`kernel/common-android14-5.15`](https://cs.android.com/android/kernel/superproject/+/common-android14-5.15:)\n- [`kernel/common-android13-5.15`](https://cs.android.com/android/kernel/superproject/+/common-android13-5.15:)\n- [`kernel/common-android13-5.10`](https://cs.android.com/android/kernel/superproject/+/common-android13-5.10:)\n\nDevelop Android kernels\n-----------------------\n\nTo develop kernels on Cuttlefish devices, follow these steps:\n\n1. Clone the appropriate kernel repo manifest for your Cuttlefish device and\n make any changes.\n\n mkdir common-android-mainline\n cd common-android-mainline\n repo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainline\n repo sync -c -j$(nproc) -q\n\n2. Build the kernel and ramdisk. For more information, see\n [Building the Vendor Modules for the Virtual Device](/docs/setup/build/building-kernels#building-gki-modules).\n\n tools/bazel run //common-modules/virtual-device:virtual_device_x86_64_dist\n\n If using `common-android-4.19-stable`, `common-android-4.14-stable`, or\n `common-android11-5.4` kernel manifests, run: \n\n BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh && BUILD_CONFIG=common-modules/virtual-device/build.config.cuttlefish.x86_64 build/build.sh\n\n Instead of building locally (to avoid downloading the kernel source,\n setting up a kernel development environment), you can download the relevant\n artifacts at ci.android.com.\n - [`android-mainline`](https://ci.android.com/builds/branches/aosp_kernel-common-android-mainline/grid?)\n - [`android16-6.12`](https://ci.android.com/builds/branches/aosp_kernel-common-android16-6.12/grid?)\n - [`android15-6.6`](https://ci.android.com/builds/branches/aosp_kernel-common-android15-6.6/grid?)\n - [`android14-6.1`](https://ci.android.com/builds/branches/aosp_kernel-common-android14-6.1/grid?)\n - [`android14-5.15`](https://ci.android.com/builds/branches/aosp_kernel-common-android14-5.15/grid?)\n - [`android13-5.15`](https://ci.android.com/builds/branches/aosp_kernel-common-android13-5.15/grid?)\n - [`android13-5.10`](https://ci.android.com/builds/branches/aosp_kernel-common-android13-5.10/grid?)\n - [`android12-5.10`](https://ci.android.com/builds/branches/aosp_kernel-common-android12-5.10/grid?)\n - [`android12-5.4`](https://ci.android.com/builds/branches/aosp_kernel-common-android12-5.4/grid?)\n - [`android11-5.4`](https://ci.android.com/builds/branches/aosp_kernel-common-android11-5.4/grid?)\n3. Launch the kernel and ramdisk with Cuttlefish.\n\n cvd create \\\n -kernel_path=./out/virtual_device_x86_64/dist/bzImage \\\n -initramfs_path=./out/virtual_device_x86_64/dist/initramfs.img\n\n If launching a non-GKI kernel (anything at or under\n 4.19), omit the `-initramfs_path` argument.\n\n If you're launching the kernel on an aarch64 version of Cuttlefish, use the\n `aarch64` build configuration and use the `Image` artifact instead of\n `bzImage`. \n\n cvd create \\\n -kernel_path=./out/virtual_device_aarch64/dist/Image \\\n -initramfs_path=./out/virtual_device_aarch64/dist/initramfs.img"]]