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
Stay organized with collections
Save and categorize content based on your preferences.
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:
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)-qBuild the bootloader target appropriate for your Cuttlefish architecture. For example:
x86_64
$tools/bazelrun//u-boot:crosvm_x86_64_distaarch64
$tools/bazelrun//u-boot:crosvm_aarch64_dist
The resulting bootloader binary (
u-boot.binfor arm64 andu-boot.romfor x86_64) is found in$PATH_TO_REPO/out/u-boot-mainline/dist.Launch the Cuttlefish device with the bootloader. Include the
pause_in_bootloaderparameter 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=trueTo interact with the bootloader, connect to the bootloader console.
$screen~/cuttlefish_runtime/consoleWhen done with bootloader interactions, continue the boot by typing
bootinto 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.imgFor more information, see Develop Android Kernels.