0

I am trying to build a GKI kernel image from aosp. After updating the kernel config, the build does not seem to use my config. Instead, it always uses some default config.

How can I build with custom kernel configs?

I am using this branch: https://android.googlesource.com/kernel/devices/google/felix/+/refs/heads/android-gs-felix-6.1-android15-qpr2-beta

I am updating the config as follows:

CC=clang ARCH=arm64 LLVM=1 make gki_defconfig

CC=clang ARCH=arm64 LLVM=1 make nconfig #this is where I edit

CC=clang ARCH=arm64 LLVM=1 make savedefconfig

mv defconfig arch/arm64/configs/gki_defconfig

make mrproper

Then I build

ENABLE_STRICT_KMI=0 BUILD_AOSP_KERNEL=1 ./build_felix.sh --kernel_package=@//aosp

But on inspecting the kernel inside the boot.img using extract-ikconfig, I find that my config changes are not present. It seem to be reset.

This workflow used to work in older aosp branches but doesn't in newer ones. I also tried using bazel but in vain

tools/bazel run //common:kernel_aarch64_config -- nconfig

How can I build with custom kernel configs?

5
  • Why are you assuming that the kernel build is going to use arch/arm64/configs/gki_defconfig? How have you tried to confirm if your assumption is true? BTW "I am updating the config as follows: ..." - This should actually be preceded with a make distclean or make mrproper. "Then I build ..." - Instead of sitting back and waiting for the build to complete, review the output on the screen to see what is actually performed. Commented Feb 6 at 1:44
  • @sawdust The older aosp branches used aosp/arch/arm64/configs/gki_defconfig and it looks like this does the same. I confirmed by removing/renaming the file (or adding a bad config) and it complains. I am running make mrproper but forgot to mention it in the question. The output unfortunately does not clearly indicate where the config is coming from. Commented Feb 6 at 3:05
  • "I confirmed by removing/renaming the file ... and it complains" - Okay, did you then locate the source code and investigate what this "it" does? Is there a make command to build the kernel, or is there something else? Commented Feb 6 at 6:23
  • Check that your new defconfig (after make savedefconfig) differs. Use scripts/diffconfig. I suspect that your changes somehow not applicable to the machine in question. Most likely due to some kernel configuration dependencies or limitations. Commented Feb 8 at 15:22
  • It looks like the "--use_prebuilt_gki=false" doesn't work as expected because device.bazelrc explicitly sets the option to download pre-built GKI. Disabling this option in the script was the only way I could get it to work. However, I guess more patching is required because after changing certain configs from 'm' to 'y', the build fails. For example, ERROR: Unable to find drivers/usb/class/cdc-acm.ko in any of the following directories: bazel-out/k8-fastbuild/bin/aosp/kernel_aarch64/staging/lib/modules/6.1.99-android14-11-gc151586fe278-dirty/kernel Commented Feb 9 at 20:27

1 Answer 1

1

BUILD_AOSP_KERNEL=1 is deprecated and only adding --kernel_package=@//aosp seems not to work for me as well. But I found this in one of the other kernel build scripts and this seems to work:

--config=no_download_gki 

E.g.,

./build_DEVICE.sh --kernel_package=@//aosp --config=no_download_gki 

Clean builds will also not download any prebuilts anymore.

https://android.googlesource.com/kernel/devices/google/akita/+/a67ed82dbf3baabcf9d5e256284961f4aa1949f7%5E%21/#F0

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.