ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
พัฒนาเคอร์เนล Android
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หน้านี้จะอธิบายวิธีพัฒนาเคอร์เนล Android ในอุปกรณ์ Cuttlefish
ไฟล์ Manifest ของเคอร์เนลที่รองรับ
Cuttlefish รองรับไฟล์ Manifest ของเคอร์เนลต่อไปนี้ในสาขารุ่นล่าสุดของ 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 ให้ทำตามขั้นตอนต่อไปนี้
โคลนไฟล์ Manifest ของที่เก็บข้อมูลเคอร์เนลที่เหมาะสมสำหรับอุปกรณ์ Cuttlefish แล้วทําการเปลี่ยนแปลง
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
สร้างเคอร์เนลและแรมดิสก์ ดูข้อมูลเพิ่มเติมได้ที่การสร้างโมดูลของผู้ให้บริการสำหรับอุปกรณ์เสมือน
tools/bazel run //common-modules/virtual-device:virtual_device_x86_64_dist
หากใช้ไฟล์ Manifest ของเคอร์เนล 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
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
หากคุณเปิดใช้งานเคอร์เนลใน Cuttlefish เวอร์ชัน aarch64 ให้ใช้การกำหนดค่าการสร้าง 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 UTC
[[["เข้าใจง่าย","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 UTC"],[],[],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"]]