Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.

Develop Android bootloader features

This page describes how to build, run, and develop Android bootloader features on a Cuttlefish device.

AOSP sources

To develop Android bootloader features, use the Cuttlefish configuration of U-boot with Cuttlefish in the latest release branch (android16-qpr2-release) or on generic system image (GSI) branches for Android 11 or higher. The following are the sources in AOSP:

Develop a bootloader

To build, run, and develop bootloader features locally, follow these steps:

  1. Clone the manifest for the Android fork of U-boot:

    $mkdiru-boot-mainline
    $cdu-boot-mainline
    $repoinit-uhttps://android.googlesource.com/kernel/manifest-bu-boot-mainline
    $reposync-j$(nproc)-q
  2. Build the bootloader target appropriate for your Cuttlefish architecture. For example:

    • x86_64

      $tools/bazelrun//u-boot:crosvm_x86_64_dist
    • aarch64

      $tools/bazelrun//u-boot:crosvm_aarch64_dist

    The resulting bootloader binary (u-boot.bin for arm64 and u-boot.rom for x86_64) is found in $PATH_TO_REPO/out/u-boot-mainline/dist.

  3. Launch the Cuttlefish device with the bootloader. Include the pause_in_bootloader parameter to disable autoboot and let you interact with the bootloader.

    $launch_cvd\
    -bootloader/$PATH/$TO/u-boot-mainline/out/u-boot-mainline/dist/u-boot.rom\
    -pause_in_bootloader-console=true
  4. To interact with the bootloader, connect to the bootloader console.

    $screen~/cuttlefish_runtime/console
  5. When done with bootloader interactions, continue the boot by typing boot into the console.

Test bootloader flow with different kernels

To test the bootloader flow with different kernels or kernel modules, pass in the target artifacts (kernel and kernel modules) using the --kernel_path and --initramfs_path arguments. The assembler repacks the boot images based on the artifacts passed in the arguments.

cvdcreate\
-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

For more information, see Develop Android Kernels.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025年12月02日 UTC.