Develop Android kernels

This page describes how to develop Android kernels on Cuttlefish devices.

Supported kernel manifests

Cuttlefish supports the following kernel manifests on main and AOSP GSI releases.

  • On aosp-main
    • common-android14-6.1
    • common-android14-5.15
    • common-android-mainline
  • On aosp-android13-gsi
    • common-android13-5.15
    • common-android13-5.10
  • On aosp-android12-gsi
    • common-android12-5.10
    • common-android12-5.4
    • common-android-4.19-stable
  • On aosp-android11-gsi
    • common-android11-5.4
    • common-android-4.19-stable
    • common-android-4.14-stable

The following are kernel sources for kernel development on Cuttlefish devices.

Develop Android kernels

To develop kernels on Cuttlefish devices, follow these steps:

  1. Clone the appropriate kernel repo manifest for your Cuttlefish device and make any changes.

    mkdir common-android14-6.1
    cd common-android14-6.1
    repo init -u https://android.googlesource.com/kernel/manifest -b common-android14-6.1
    repo sync -c -j$(nproc) -q
  2. Build the kernel and ramdisk. For more information, see Building the Vendor Modules for the Virtual Device.

    tools/bazel run //common-modules/virtual-device:virtual_device_x86_64_dist

    If using common-android-4.19-stable, common-android-4.14-stable, or common-android11-5.4 kernel manifests, run:

    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

    Instead of building locally (to avoid downloading the kernel source, setting up a kernel development environment), you can download the relevant artifacts at ci.android.com.

  3. Launch the kernel and ramdisk with Cuttlefish.

    cvd create \
        -kernel_path=/$PATH/$TO/common-android14-6.1/out/android14-6.1/dist/bzImage \
        -initramfs_path=/$PATH/$TO/common-android14-6.1/out/android14-6.1/dist/initramfs.img

    If launching a non-GKI kernel (anything at or under 4.19), omit the -initramfs_path argument.

    If you're launching the kernel on an aarch64 version of Cuttlefish, use the aarch64 build configuration and use the Image artifact instead of bzImage.

    cvd create \
        -kernel_path=/$PATH/$TO/common-android14-6.1/out/android14-5.15/dist/Image \
        -initramfs_path=/$PATH/$TO/common-android14-6.1/out/android14-5.15/dist/initramfs.img