Android is an operating system based on the Linux kernel, but the kernel running on an Android device is actually a very different version of the Linux kernel that Google chose. Before reaching each Android device, the kernel goes through a three-stage fork: Google selects an LTS (long-term support) version of the Linux kernel, puts a specific patch on the Android operating system, making it the Android universal kernel; Give SoC vendors such as Qualcomm a hardware patch, and finally, the SoC kernel is handed over to the device manufacturer, patching the device-specific components, which also constitutes the device kernel in each device.
This is a lengthy process, with multiple forks and dealing with millions of lines of code slowing down the entire development. As a result, Android devices use a kernel that is two to three years behind the Linux kernel mainline. Google recently released the Pixel 4 in October, and its Linux kernel is the 4.14 LTS version released in November 2017. And because of the heavy workload, Android devices usually don’t get kernel updates, and it stays on version 4.14 forever.
Furthermore, the cores of different devices vary, and the specific kernels of one device cannot work on other devices. As a result, Google is trying to close the gap between the Android device cores and the main-line Linux kernels and bring the device kernel closer to the upstream kernel mainline.
At this year’s Linux Plumbers Conference, Sandeep Patil, head of the Android kernel team, said their goal was to fundamentally find what Android needed to run, but not run on a given piece of hardware. It is then introduced upstream and as close to the main line as possible.
Google’s plan is to replicate its early work project Treble to modular Isandroid. Project Treble is used to create a stable interface between Android and HAL (hardware abstraction layer). Similarly, Google plans to stabilize Linux’s kernel ABI, providing a stable write interface that allows hardware vendors to easily insert code and ultimately eliminate specific device cores.
Google’s senior software engineer, Matthias M?nnich, presents a picture of the kernel architecture in anticipation. The Next Generation Android Device kernel will consist of generic Kernel Image (GKI) and several GKI modules, and drivers for specific hardware (possibly closed-source drivers) will be loaded as kernel modules. In short, in this scenario, everything is modularized.
Given the technical barriers and diversity of the Android ecosystem, this should not be easy. In any case, bringing the Android device kernel into the mainline Linux kernel is sure to benefit many people, including Android users, phone manufacturers, and the Linux community. But Google’s plans are just beginning, and much more needs to be done.