Android to Adopt “Upstream First” Development Model for Linux Kernel
The Linux Plumbers Conference is taking place this week, and as Android is one of the largest distributors of the Linux kernel in the world, Google software engineer Todd Kjos stopped by for a progress report from the Android team. Android 12, which will be released overnight, promises to bring Android closer than ever to mainstream Linux by providing Google’s “Generic Kernel Image” (GKI) to end users.
Traditionally, the Linux kernel has been forked multiple times before it reaches an Android phone, usually by each stakeholder on an Android device. First of all, Google divides the Linux kernel into “common Android” – the Linux kernel plus a bunch of phone and Android specific changes. Then SoC providers like Qualcomm, Samsung or MediaTek fork Android Common to create a SoC-specific kernel for each major version of the chip. Then, each device receives a fork of the SoC kernel for device-specific hardware support.
Android’s core fragmentation is a huge mess, and you can imagine how long and difficult it is for a bug fix at the top of the fork shaft to reach the bottom, where end users live. . The official Android.com documentation notes that “These changes can be extended to the point that up to 50% of the code executed on a device is code outside the tree (no upstream Linux or AOSP common kernels). ). âIt’s a big time sink too, and even Google phones typically ship cores that start at two years old.
Google has set out to reduce the distance between Android and Linux with the GKI. The goal is for Google to fork the Linux kernel once for Android, instead of three times, and give SoC and device makers space for their customizations through plug-in modules.
Kjos explained, âThe most important thing is to extract all hardware-specific code from the generic kernel and into vendor modules. One of the big parts of this effort is that we need to have a stable interface between these vendor modules and the generic kernel so that they can be delivered asynchronously. âThis interface is calledâ KMI âorâ Kernel Module Interface â. Kjos now says that the “main difference” between Android GKI and main Linux is all of these vendor modules.
Kjos says Google prefers short brackets for these vendor modules as opposed to off-tree code because “we want to be as close to the upstream as possible.” Google is also working to push vendor code back upstream, but admits, “This is a multi-year project, and we don’t expect to ever get there.” Kjos has established a timeline for the next few years of kernel work, which has 2020-2022 as working upstream of existing functionality and isolation of vendor changes in modules, and starting in 2023, adopting an “upstream first” development model for new functionalities. âSince the out-of-tree modules are really important to our use case, we would expect that we would always have a set of exports and some things that are different or in addition to what is upstream, but This whole project is a multi-year project working to get as many patches off the tree as possible and align as much as possible upstream. “
Google’s work on the generic kernel image is in line with Project Treble, which built a GSI (or “Generic System Image”) allowing versions of Android to be updated regardless of hardware support. Today you may blink a generic version of Android on a phone and make it mostly work, but the usual policy of OEM customizations has meant that generic system images don’t ship on mainstream devices. The GKI is different though, and Google actually plans to ship generic kernels to end users.
Although not mentioned in the talk, Google is working on distributing the GKI as a a “Mainline Project” module, which would allow kernel updates shipped through the Play Store, where the kernel can be updated as easily as an app. We’ve interviewed Android team members several times on the GKI, and the plan eventually is to be able to not only update LTS kernel versions through the Play Store, but also upgrade to them. new major versions. Today, LTS kernel updates occasionally arrive via OTA updates, but devices typically don’t jump to new major kernel versions.
The GKI’s shipping time to consumers is âAndroid 12,â and since this basic core work only happens on new devices, all eyes will be on the Pixel 6 to see how good the first attempt is. of Google in this area will be ambitious. The Pixel 6 is the first device to come with an internal “Google Tensor” SoC, and if the theories about longer Google support times are correct, being able to skip major kernel versions would be a big help with cycles. support life that exceeds five years. Assuming the Pixel 6 ships with the Linux kernel 5.10 – which has been mentioned several times in this conference – it will just be a big improvement over the usual two-year timeframe – 5.10 was released in December 2020.
List image by SOPA Images / Getty Images