During the last Linux Plumbers 2021 conference, Google unveiled on the success of the initiative to move the Android platform to use a normal Linux kernel instead of using its own version of the kernel, which includes specific changes for the Android platform.
Google mentions that said development change is due to the decision to switch to the "Upstream First" model after 2023, which involves developing all the new kernel features required on the Android platform directly in the main Linux kernel and not in its separate branches (the functionality will be promoted to the main kernel first and then used in Android, and not the other way around ).
For 2023 and 2024, it is also planned to transfer to the main kernel all additional patches that remain in the Android Common Kernel branch.
As for the near future, for the Android 12 platform scheduled for early October, builds of the "Generic Kernel Image" (GKI) kernel will be offered, as close as possible to the usual 5.10 kernel.
For these builds a regular release of updates will be provided, which will be placed in the repository ci.android.com. In the GKI kernel, Android-specific additions, as well as OEM hardware-related drivers, are moved to separate kernel modules.
These modules are not tied to the major version of the kernel and can be developed separately, which greatly simplifies maintenance and device transfer to new kernel branches.
The interfaces required by device manufacturers are implemented in the form of hooks that allow you to change the behavior of the kernel without making changes to the code.
In total, the android12-5.10 kernel offers 194 common hooks, similar to trace points, and 107 specialized hooks that allow you to run controllers in a non-atomic context. In the GKI kernel, hardware manufacturers are prohibited from applying specific patches to the main kernel, and vendors must supply the components for the supporting hardware only in the form of additional kernel modules, in which compatibility with the main kernel must be ensured. main kernel.
We must remember that the platform Android develops its own branch of the kernel: the "Android Common Kernel", on the basis of which separate specific builds for each device are formed.
With which, from each branch of Android, manufacturers are provided with multiple kernel designs for their devices. For example, Android 11 offered a choice of three base cores at once: 4.14, 4.19 and 5.4, and for Android 12, the base cores 4.19, 5.4 and 5.10 will be offered. The 5.10 variant is designed as a generic kernel image, in which the capabilities needed by OEMs are carried upstream, moved to modules, or carried over to the common Android kernel.
Before the arrival of GKI, The Android kernel went through several stages of preparation:
- The first one was based on the main LTS kernels (3.18, 4.4, 4.9, 4.14, 4.19, 5.4) and of which a fork of the "Android Common Kernel" was created, to which specific patches for Android were transferred ( previously, the size of the changes was reached several million lines).
- After that on "Android Common Kernel", chip makers like Qualcomm, Samsung and MediaTek form the SoC Kernel, which includes plugins to support hardware.
- Finally in the "SoC Kernel", device manufacturers create the "Device Kernel", including changes related to compatibility with additional equipment, displays, cameras, sound systems, and so on.
This approach significantly complicated the delivery of updates with the elimination of vulnerabilities and the transition to new branches of the kernel. While Google regularly releases updates for its common Android kernel, vendors often take time to push these updates out or use a single kernel for the entire device lifecycle.
Finally if you are interested in knowing more about it, you can check the details In the following link.