Trang này mô tả cách phát triển nhân Android trên các thiết bị Cuttlefish.
Tệp kê khai nhân được hỗ trợ
Cuttlefish hỗ trợ các tệp kê khai kernel sau đây trên nhánh phát hành mới nhất của Android và các bản phát hành GSI của AOSP.
- Vào ngày
android-latest-releasecommon-android-mainline
- Vào ngày
android-15.0.0_r36common-android16-6.12common-android15-6.6common-android14-6.1common-android14-5.15
- Vào ngày
aosp-android13-gsicommon-android13-5.15common-android13-5.10
- Vào ngày
aosp-android12-gsicommon-android12-5.10common-android12-5.4common-android-4.19-stable
- Vào ngày
aosp-android11-gsicommon-android11-5.4common-android-4.19-stablecommon-android-4.14-stable
Sau đây là các nguồn kernel để phát triển kernel trên các thiết bị Cuttlefish.
kernel/common-android-mainlinekernel/common-android16-6.12kernel/common-android15-6.6kernel/common-android14-6.1kernel/common-android14-5.15kernel/common-android13-5.15kernel/common-android13-5.10
Phát triển nhân Android
Để phát triển các nhân trên thiết bị Cuttlefish, hãy làm theo các bước sau:
Sao chép tệp kê khai kho lưu trữ kernel thích hợp cho thiết bị Cuttlefish của bạn và thực hiện mọi thay đổi.
mkdir common-android-mainlinecd common-android-mainlinerepo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainlinerepo sync -c -j$(nproc) -qTạo kernel và ramdisk. Để biết thêm thông tin, hãy xem phần Tạo các mô-đun của nhà cung cấp cho thiết bị ảo.
tools/bazel run //common-modules/virtual-device:virtual_device_x86_64_distNếu sử dụng tệp kê khai nhân
common-android-4.19-stable,common-android-4.14-stablehoặccommon-android11-5.4, hãy chạy:BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh && BUILD_CONFIG=common-modules/virtual-device/build.config.cuttlefish.x86_64 build/build.shThay vì tạo cục bộ (để tránh tải nguồn nhân xuống, thiết lập môi trường phát triển nhân), bạn có thể tải các cấu phần phần mềm có liên quan xuống tại ci.android.com.
Khởi chạy nhân và ramdisk bằng Cuttlefish.
cvd create \ -kernel_path=./out/virtual_device_x86_64/dist/bzImage \ -initramfs_path=./out/virtual_device_x86_64/dist/initramfs.imgNếu khởi chạy một nhân không phải GKI (mọi thứ ở mức 4.19 trở xuống), hãy bỏ qua đối số
-initramfs_path.Nếu bạn đang chạy nhân trên phiên bản aarch64 của Cuttlefish, hãy sử dụng cấu hình bản dựng
aarch64và sử dụng cấu phần phần mềmImagethay vìbzImage.cvd create \ -kernel_path=./out/virtual_device_aarch64/dist/Image \ -initramfs_path=./out/virtual_device_aarch64/dist/initramfs.img