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-release
common-android-mainline
- Vào ngày
android-15.0.0_r36
common-android16-6.12
common-android15-6.6
common-android14-6.1
common-android14-5.15
- Vào ngày
aosp-android13-gsi
common-android13-5.15
common-android13-5.10
- Vào ngày
aosp-android12-gsi
common-android12-5.10
common-android12-5.4
common-android-4.19-stable
- Vào ngày
aosp-android11-gsi
common-android11-5.4
common-android-4.19-stable
common-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-mainline
kernel/common-android16-6.12
kernel/common-android15-6.6
kernel/common-android14-6.1
kernel/common-android14-5.15
kernel/common-android13-5.15
kernel/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-mainline
cd common-android-mainline
repo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainline
repo sync -c -j$(nproc) -q
Tạ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_dist
Nếu sử dụng tệp kê khai nhân
common-android-4.19-stable
,common-android-4.14-stable
hoặ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.sh
Thay 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.img
Nế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
aarch64
và sử dụng cấu phần phần mềmImage
thay vìbzImage
.cvd create \ -kernel_path=./out/virtual_device_aarch64/dist/Image \ -initramfs_path=./out/virtual_device_aarch64/dist/initramfs.img