Skip to content

[kernel] - remove the effort of re-generating defconfig every alignment #30

Closed

Description

@nguyenanhgiau

Hi @KonstaT

Thank you for your great work on Android kernel for RPi4.
I observe that you have to re-generate defconfig for RPi4/5 every time you merge the kernel mainline into your branch.
https://github.com/raspberry-vanilla/android_kernel_brcm_rpi/commits/android-17.0/

Now, I have found a new way to reduce your effort.
My procedure is below:

  1. Update the bazel build rule for rpi4: set defconfig to gki_defconfig and add pre_defconfig_fragment.
kernel_build(
    name = "rpi4",
...
    defconfig = "arch/arm64/configs/gki_defconfig",
    make_goals = [
        "Image",
        "modules",
        "dtbs",
    ],
    makefile = ":Makefile",
    module_outs = get_gki_modules_list("arm64") + get_kunit_modules_list("arm64") + _RPI_MODULE_OUTS,
    pre_defconfig_fragments = ["arch/arm64/configs/bcm2711_gki.fragment"],
    strip_modules = True,
)
  1. Remove all lines that end with "is not set" in arch/arm64/configs/bcm2711_gki.fragment
  2. Run the command:
tools/bazel run --config=fast --config=stamp //common:rpi4_config -- menuconfig

to check the content of bcm2711_gki.fragment.
Correct any errors until it shows the menuconfig successfully.
Note: I only found CONFIG_BT_HCIUART needs to be changed from y to m.
After the menu was displayed, just exit it. The bcm2711_gki.fragment file will be automatically updated and sorted.
4. Build to test the new file:

tools/bazel build --config=fast --config=stamp //common:rpi4 --verbose_failures

We may fail because of missing copying some kernel modules:

ERROR: The following kernel modules are built but not copied. Add these lines to the module_outs attribute of @@//common:rpi4:
    "drivers/bluetooth/btqca.ko",
    "drivers/char/broadcom/bcm2835_smi_dev.ko",
    "drivers/bluetooth/hci_uart.ko",
    "drivers/bluetooth/btbcm.ko",
    "drivers/power/sequencing/pwrseq-core.ko",
    "drivers/misc/bcm2835_smi.ko",
Alternatively, install buildozer and execute:

Update the _RPI_MODULE_OUTS to fix it:

_RPI_MODULE_OUTS = [
    # keep sorted
    "drivers/bluetooth/btqca.ko",
    "drivers/char/broadcom/bcm2835_smi_dev.ko",
    "drivers/bluetooth/hci_uart.ko",
    "drivers/bluetooth/btbcm.ko",
    "drivers/power/sequencing/pwrseq-core.ko",
    "drivers/misc/bcm2835_smi.ko",
]

If we use this method, we don't need to re-generate defconfig.
I hope my work can save you time.
I'm creating a pull request, but I need your feedback first.

Thanks!

Activity

  1. nguyenanhgiau commented on Nov 20, 2026

    @nguyenanhgiau
    Author
  2. KonstaT commented on Nov 23, 2026

    @KonstaT
    Member

    I observe that you have to re-generate defconfig for RPi4/5 every time you merge the kernel mainline into your branch.
    Now, I have found a new way to reduce your effort.

    It actually reduces my effort that I keep track of the complete .config. It makes it immediately clear what options are enabled in the kernel and what are not.

    E.g. when someone asks why their obscure piece of hardware doesn't work in Android, it's easy to link a specific line in the .config to point out that the kernel driver is not enabled (and make a follow up question what they would do with the kernel driver alone if there's no support for the said piece of hardware in the higher levels in the architecture, HAL etc).

    Some change upstream breaks something. E.g. the latest merge on android-16.0 branch disabled driver that we need for this hardware. Keeping track of the complete .config made it clear and it was very easy to spot and fix.
    raspberry-vanilla/android_kernel_brcm_rpi@f01e6c2
    raspberry-vanilla/android_kernel_brcm_rpi@88f12ba

    Configs are maintained in a way that {bcm2711|bcm2712}_defconfig and gki_defconfig stay unchanged from their upstreams (raspberry/rpi-6.18.y and aosp/android17-6.18-lts, respectively). {bcm2711|bcm2712}_gki.fragment and android_{rpi4|rpi5}_defconfig need to be maintained for this project. gki_defconfig and {bcm2711|bcm2712}_gki.fragment is used to generate the complete .config (android_{rpi4|rpi5}_defconfig). Complete .config is used to compile the kernel in the end.

    Remove all lines that end with "is not set" in arch/arm64/configs/bcm2711_gki.fragment

    I've intentionally wanted to disable some things that would otherwise be enabled from gki_defconfig. As commented in raspberry-vanilla/android_kernel_brcm_rpi#9 there's some SUNXI/HISI/QCOM/TEGRA/etc platform specific stuff we don't need on this hardware and UBSAN needs to be disabled for some reason for video decoding to work.

    Update the _RPI_MODULE_OUTS to fix it:

    It's also a design choice that I'm not using any modules. All required drivers are built into the kernel Image. While some GKI modules are built, they are never copied to OS image (and thus never loaded) on Raspberry Vanilla device configuration.

    Some required drivers that would be built as GKI modules are built into the kernel Image instead. You would rather revert my changes in bazel/modules_private.bzl (raspberry-vanilla/android_kernel_brcm_rpi@0b7d0c9) if you wanted to bring them back as modules.

    Updating the kernel by pushing updated Image to boot partition makes development much easier vs. also copying matching kernel modules to three different places (ramdisk, system_dlkm, vendor_dlkm) keeping track which ones belong where.

  3. KonstaT commented on Nov 23, 2026

    @KonstaT
    Member

    I also looked up your project (https://github.com/nguyenanhgiau/GloDroidPlus_manifest).

    Genuine question, if ~90% of the Raspberry Pi hardware specific implementation is from Raspberry Vanilla (yes, that is how you would reference my project - not Raspberry-vanilla), how is that GloDroidPlus?

    What is not from Raspberry Vanilla at this point? E.g. https://gitlab.com/glodroid_platform/device/glodroid/ certainly rather looks like a fork of https://github.com/raspberry-vanilla/android_device_brcm_rpi4 than https://github.com/GloDroid/glodroid_configuration and https://github.com/GloDroidCommunity/raspberry-pi. Almost all HALs are from Raspberry Vanilla. Almost all external projects used for hardware support are from Raspberry Vanilla as well.

    How about coming up with a completely unique name for your project (I wouldn't want it to be called Raspberry Vanilla Plus either)?

    How about working towards implementing the missing bits (U-Boot/GBL, recovery, dynamic partitions, A/B, AVB, etc) on top of Raspberry Vanilla instead?

  4. nguyenanhgiau commented on Nov 23, 2026

    @nguyenanhgiau
    Author

    Hi Konsta,

    Thank you for taking the time to look into my repository and for the honest feedback. You are completely right -
    even though I listed Raspberry Vanilla in the README's acknowledgements, keeping the name GloDroidPlus and framing it as an equal combination is misleading and doesn't accurately reflect that the vast majority of the hardware support and HALs come from your work.

    For a bit of context, I originally started with GloDroid v1.0. However, when GloDroid v2.0 shifted to a single-repo, patch-based workflow with non-Treble (Meson) modules - and eventually stopped development after Android 15 - I transitioned to integrating Raspberry Vanilla's much cleaner, Treble-compliant hardware support and HALs.

    I will rename the project to something unique, fix the naming reference (Raspberry Vanilla), and update the README to clearly reflect that it is built on top of your foundation.

    On the technical side, my main goal with this project has been experimenting with and implementing those exact missing system pieces -specifically U-Boot, AVB, recovery, and partition layouts - to bring a more standard Android boot and security flow to the Raspberry Pi 4. Restructuring my work cleanly as a layer on top of Raspberry Vanilla (and contributing back where it makes sense) sounds like a much better path forward.

    Thanks again for all your great work on Raspberry Vanilla and for pointing this out!

  5. KonstaT commented on Nov 24, 2026

    @KonstaT
    Member

    On the technical side, my main goal with this project has been experimenting with and implementing those exact missing system pieces -specifically U-Boot, AVB, recovery, and partition layouts - to bring a more standard Android boot and security flow to the Raspberry Pi 4.

    Which are very good goals.

    Best of luck with your project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions