Google plans to use the Linux kernel mainline on the Android devices

Android is an operating system based on the Linux kernel, but the kernel running on an Android device is quite different from the LTS version of the Linux kernel chosen by Google.

Before reaching every Android device, the kernel will go through three stages of fork: Google will first select an LTS (long-term support) version of the Linux kernel, and apply a specific patch of the Android operating system to make it an Android universal kernel; Then, the general-purpose kernel is delivered to SoC vendors such as Qualcomm, and hardware patches are applied. Finally, the SoC core is handed over to the device manufacturer, and device-specific component patches are applied, which constitutes the device core to each device.

This is a long process, and executing multiple forks and processing millions of lines of code greatly slows down the entire development process. Therefore, the kernel used by Android devices lags behind the mainline of the Linux kernel by two to three years. Google recently released Pixel 4 in October, and its Linux kernel is the 4.14 LTS release released in November 2017. And because of the excessive workload, Android devices usually do not get kernel updates, it will stay on version 4.14 forever.

Linux Kernel 4.20

Furthermore, the cores of various devices are different, and the specific kernel of one device cannot work on other devices. As a result, Google is trying to narrow the gap between the Android device kernel and the mainline Linux kernel, bringing the device core closer to the upstream kernel mainline.

At this year’s Linux Plumbers Conference, Sandeep Patil, head of the Android kernel team, said that their goal is to fundamentally find what Android needs to run, but don’t have to run on a given piece of hardware, then bring it upstream and do it. May be close to the mainline.

Google’s plan is to replicate its early work Project Treble to modularize Android. 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 to provide a stable write interface that allows hardware vendors to easily insert code and ultimately eliminate specific device cores.

Matthias Männich, a senior software engineer at Google, presented an envisioned kernel architecture diagram. The “next-generation Android device” kernel will consist of a generic kernel image (GKI) and multiple GKI modules, and specific hardware drivers (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 an easy task. In any case, bringing the Android device kernel to the mainline Linux kernel will certainly benefit many people, including Android users, mobile phone manufacturers, and the Linux community. However, Google’s plan has just begun, and there is more work to be done.

Via: arstechnica