Google will move to the development of innovations for Android in the main Linux kernel

At the recent Linux Plumbers 2021 conference, Google talked about the success of the initiative to move the Android platform to use the regular Linux kernel instead of using its own version of the kernel, which includes changes specific to the Android platform.

The most important change in development was the decision to move to the “Upstream First” model after 2023, which implies the development of all new kernel features required in the Android platform directly in the main Linux kernel, and not in their own separate branches (functionality will first be promoted to the main kernel, and then used in Android, and not vice versa). All additional patches remaining in the Android Common Kernel branch are also scheduled to be transferred to the main kernel in 2023 and 2024.

As for the near future, for the expected Android 12 platform in early October, builds of the “Generic Kernel Image” (GKI) kernel will be offered, as close as possible to the regular 5.10 kernel. These builds will receive regular updates and be hosted in the ci.android.com repository. In the GKI kernel, Android-specific add-ons, as well as OEM-related hardware support handlers, are moved into separate kernel modules. These modules are not tied to the version of the main kernel and can be developed separately, which greatly simplifies the maintenance and transition of devices to new kernel branches.

Google will move to the development of innovations for Android in the main Linux kernel

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 regular hooks, similar to tracepoints, and 107 specialized hooks that allow you to run handlers in a non-atomic context. In the GKI kernel, hardware manufacturers are prohibited from applying specific patches to the main kernel, and components for supporting hardware must be supplied by vendors only as additional kernel modules, which must be compatible with the main kernel.

Recall that the Android platform develops its own kernel branch - the Android Common Kernel, on the basis of which separate specific assemblies are formed for each device. In each branch of Android, manufacturers are provided with several options for the layout of the kernels for their devices. For example, in Android 11, three base kernels were offered at once - 4.14, 4.19 and 5.4, and for Android 12 base kernels 4.19, 5.4 and 5.10 will be offered. Version 5.10 is designed as a Generic Kernel Image, in which the features necessary for OEMs are transferred to the upstream, moved to modules, or transferred to the Android Common Kernel.

Prior to the advent of GKI, the Android kernel went through several stages of preparation:

  • On the basis of the main LTS kernels (3.18, 4.4, 4.9, 4.14, 4.19, 5.4), an Android Common Kernel branch was created, into which patches specific to Android were transferred (previously, the size of changes reached several million lines).
  • Based on the "Android Common Kernel", chip manufacturers such as Qualcomm, Samsung and MediaTek have formed "SoC Kernels" that include additions to support the hardware.
  • Based on the "SoC Kernel", device manufacturers created the "Device Kernel", including changes related to support for additional hardware, screens, cameras, sound systems, etc.

Such an approach made it much more difficult to bring updates with the elimination of vulnerabilities and the transition to new kernel branches. While Google regularly releases updates to its Android Common Kernels, vendors are often slow to deliver these updates, or even use a single core for the entire lifecycle of a device.



Source: opennet.ru

Add a comment