How do I properly build an Android kernel then build the AOSP with this kernel? For now I am virtualizing Android on a Linux x86_64 host. The AOSP lunch option I use is aosp_cf_x86_64_phone-userdebug
. The AOSP is on the master branch and synced back in January 2022.
I am building my own Android kernel by following these instructions: https://source.android.com/setup/build/building-kernels
I have done these steps:
- repo synced to the
common-android12-5.10
branch on https://android.googlesource.com/kernel/manifest BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh
BUILD_CONFIG=common-modules/virtual-device/build.config.virtual_device.x86_64 build/build.sh
This gives me a android-kernel/out/android12-510/dist/bzImage
. I tried following the instructions of https://source.android.com/setup/build/building-kernels#running by doing export TARGET_PREBUILT_KERNEL=$(realpath android-kernel/out/android12-510/dist/bzImage)
then m bootimage
and make bootimage
, neither make
or m
copied over the kernel.
So I then tried hard copy-pasting over the prebuilt kernel in aosp/kernel/prebuilts/5.10/x86_64
where I pasted over kernel-5.10
and kernel-5.10-allsyms
then just kernel-5.10
where make bootimage
and m bootimage
copied over my built kernel. But both ways didn't have Android bootup via launch_cvd
, it kept rebooting over and over.
What is the proper way of providing your custom built Android kernel to the AOSP and building the AOSP with the kernel? Why isn't Android starting up with a hard copy-pasted kernel file?