In this scenario, everything will be modularized.

Editor’s note: This article is from WeChat public account “CSDN” (ID:CSDNnews) , finishing Guo Wei.

As the only mobile operating system on the market that can compete with iOS, the importance of the Android-based Android system is self-evident. However, in order to make it more suitable for the needs of smart phones, OEMs such as Huawei, Samsung and Google itself, and even chip manufacturers such as Qualcomm and MediaTek have actually made a lot of changes in the underlying aspects of the Android system. This inevitably brings many problems such as system security and maintainability, which is highly plagued by developers.

Why do Android devices always run old kernels?

If you have a certain understanding of the phone, then you must know that Google’s Android system is based on the Linux kernel operating system, but the kernel running on the Android device is actually very different from the LTS version of the Linux kernel selected by Google. .

Generally, the kernel used by Android devices will experience three forks:

First, Google chose an LTS version and turned it into an Android Common kernel — a patch specific to Android OS;

Android Common is then provided to SoC vendors such as Qualcomm, undergoing a second fork, and patching Qualcomm hardware into a SoC core;

The kernel is then provided to the device manufacturer for a third fork, and the kernel patch that supports the different components of the device becomes the device kernel, which is finally provided to the client with the mobile phone.

At the Linux Plumbers conference last year, Google engineer Sandeep Patil also introduced this issue in detail. He said:

Android kernel is originally from the main lineLong-term stable (LTS) versions that combine the proprietary code of the Android core to form the Android common kernel version. Vendors choose a common core and then add more extra-tree code to create a system-on-a-chip (SoC)-specific kernel that is available to device manufacturers.

In the end, one of these SoC kernels is frozen, possibly adding some extra-tree code as a kernel for a specific device model. Now, it takes only a few weeks to merge an LTS version into the Android public kernel, but it still takes years to become a device kernel.

This is why Android devices always run old kernels.

Taking the latest flagship phone Pixel 4 released in Google in October, it uses the Linux kernel 4.14 LTS, which was released in November 2017, and for the foreseeable future, this model will always Staying at 4.14 – In short, the development and management of the Android kernel eliminates many of the advantages of using Linux from the start: kernel updates are slow, and the use of a large amount of out-of-tree code makes it extremely difficult to incorporate new stable updates.

In order to reduce such code, improve the security of the system, and also to maintain the system more conveniently, Google has invested a lot of resources, and tried to narrow the gap between the Android device kernel and the mainline Linux kernel, let the device kernel Closer to the upstream kernel main line.

Modern future?

At this year’s Linux Plumbers Conference, Google engineers gave a presentation on how the company brought the underlying Android system closer to the mainstream Linux kernel.

There is a modular approach: Google plans to stabilize Linux’s kernel ABI, which will consist of Generic Kernel Image (GKI) and multiple GKI modules to load the required hardware drivers or other patches in a modular fashion. This provides a stable write interface that allows hardware vendors to easily insert code and ultimately eliminate specific device cores.

In short, everything in this vision will be modularized.

With the evolution of the Linux kernel, the current Linux kernel is more suitable for use in mobile devices than ever before, so Google does not need to make major changes to the current mainstream system kernel. Google said that the first step in the plan is to make more changes to the Android kernel.Return to the mainstream Linux kernel.

As of February 2018, the Android Universal Core inserted 32,000 lines of code and removed more than 1500 lines of code compared to the Linux 4.14.0 kernel. Compared to the insertion of 60,000 lines of code a few years ago, Google has significantly reduced the degree of modification to the kernel code.

In addition, according to Google’s plan, the Fuchsia system currently under development will replace the current mainstream Android system in the future. This system with a custom kernel can better eliminate the technical barriers associated with Linux systems. For chipmakers and OEMs, Google differentiates drivers and applications from the Android kernel to maintain the purity of the system’s kernel—the Project Treble project launched in 2017 is part of Google’s plan.

This also means that although the dream of running the mainline kernel on Android devices has not been realized, Google’s actions may make this day faster than expected.

Write at the end

In any case, bringing the Android device kernel to the main line The Linux kernel is sure to be the future, and many people, including Android users, mobile phone manufacturers and the Linux community, will benefit. Google has been working hard to guide the Android kernel as close to the main line as possible. But considering the technical barriers and diversity of the Android ecosystem, this should not be an easy task.

But Google’s plan has just begun, and the follow-up work is left to be completed.

Reference link:

https://arstechnica.com/gadgets/2019/11/google-outlines-plans-for-mainline-linux-kernel-support-in-android/

https://www.solidot.org/story?sid=62680

https://blog.csdn.net/weixin_33725270/article/details/89167718