Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapting For MTK #436

Open
hopez13 opened this issue Oct 26, 2024 · 1 comment
Open

Adapting For MTK #436

hopez13 opened this issue Oct 26, 2024 · 1 comment

Comments

@hopez13
Copy link

hopez13 commented Oct 26, 2024

We have MTK lk source code here
https://github.com/Gigaset-dev/lk2
However, for devices with secure boot enabled, modifying the primary bootloader is not an option. The only feasible approach is to deploy a proxy secondary bootloader.
https://source.android.com/docs/core/architecture/partitions/generic-boot

Motivation

With the advent of the Generic Kernel Image (GKI) architecture, device partitioning has evolved, resulting in varied recovery partition structures across devices. Some devices use a single dedicated recovery partition, others use an A/B recovery setup (e.g., recovery_a and recovery_b), while some lack a dedicated recovery partition altogether. More information on these partition configurations can be found here.

On devices with non-A/B recovery, a distinct kernel is used specifically for recovery. However, in devices with A/B partition schemes or without a dedicated recovery, the same kernel is used for both recovery and normal boot, effectively making recovery useless for kernel development

By implementing a proxy bootloader, we can address this limitation by loading the recovery kernel from the boot_b slot, ensuring recovery functionality even if kernel is broken during development

How Can We Adapt lk2nd for MTK
Thanks

@TravMurav
Copy link
Member

Hi!

How Can We Adapt lk2nd for MTK

Unfortunately lk2nd project is /very/ qcom-centric and uses/relies on a significant amount of CAF code from old qcom's lk. This means that it's most likely unreasonable to add another platform support into lk2nd since the effort needed to implement and maintain that would be way too big.

You're better off creating a different, mtk-specific secondary bootloader based on whatever their BSP bootloader is available for your platform of interest. In this case you may feel free to reuse some of the things implemented in lk2nd, (though I don't think there is that many things that can be reused as-is.)

If you're looking into making such bootloader from scratch, I'd also recommend you to look into using u-boot as a secondary bootloader, which may give you many useful features such as UEFI and will likely be a better choice long term.

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

No branches or pull requests

2 participants