The Linux Plumbers Conference is this week, and since Android is one of the largest distributors of the Linux kernel in the world, Google software engineer Todd Kjos stopped at For progress reports from the Android team. Android 12—which will be out any day now—promises to bring Android closer to mainline Linux by sending Google’s “Generic Kernel Image” (GKI) to end-users.
Traditionally, the Linux kernel is forked several times before it hits Android phones, usually by each stakeholder in an Android device. First, Google forked the Linux kernel into “Android Common”—the Linux kernel plus a bunch of phones—and Android-specific changes. Then SoC vendors like Qualcomm, Samsung, or MediaTek fork Android Common to build a SoC-specific kernel for each major chip release. Then each device gets a fork of the SoC kernel for device-specific hardware support.
Android’s kernel fragmentation is a huge mess, and you can imagine how long and difficult the road is for a bugfix at the top of the fork tree to reach the bottom, where end users live. The official Android.com documentation notes that “these modifications can be widespread, to the extent that 50% of the code running on a device is out-of-tree code (not from upstream Linux or the AOSP normal kernel).” It’s also a huge time sink, and even Google phones typically ship kernels that start at age two.
Google is on a journey to bridge the gap between Android and Linux with GKI. Google aims to fork the Linux kernel for Android once instead of three times, and give SoC and device manufacturers space to optimize them through plug-in modules.
Kjos explained, “There’s a big push to get all hardware-specific code out of 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 those vendor modules and the generic ones. kernels so that they can ship asynchronously.” This interface is called “KMI” or “Kernel Module Interface”. Kejos says that now the “main difference” between the Android GKI and mainline Linux are hooks for all of these vendor modules.
Kjos says that Google prefers smaller hooks for these vendor modules as opposed to out-of-tree code, because “we want to be as close to upstream as possible.” Google is also working on upstreaming the vendor code, but acknowledges, “It’s a multi-year project, and we don’t expect we’ll ever be able to get there.” Kjos set a timeline for kernel work over the next few years, with 2020-2022 working toward upstreaming existing features and isolating vendor changes to modules, and starting 2023, for new features.” Upstream First” development model. “Since out-of-tree modules are really important for our use case, we expect that we will always have a set of exports and some things that are different or that are apart of the upstream, but this whole project is one The multi-year project is to work towards getting rid of as many out-of-tree patches as possible, and aligning with as many upstream as possible.”
Google’s generic kernel image works in a similar fashion to that of Project Treble, which created a GSI (or “Generic System Image”) to allow versions of Android to be updated independently of hardware support. Today you can flash A generic version of Android for a phone and it mostly works, but the general politics related to OEM customization means that generic system images don’t ship on consumer devices. GKI is different though, and Google plans to actually ship generic kernels to end users.
While not mentioned in the conversation, Google is working on distributing GKI as A “Project Mainline” module, which will allow kernel updates shipped via the Play Store, where the kernel can be easily updated as an app. We’ve interviewed members of the Android team several times about GKI, and the plan is, eventually, to be able to update not only LTS kernel versions via the Play Store, but also upgrades to major new releases. Today, LTS kernel updates sometimes arrive via OTA updates, but devices usually don’t move to major new kernel versions.
GKI’s shipping deadline to consumers is “Android 12,” and since this core kernel work only happens on newer devices, all eyes will be on the Pixel 6 to see how ambitious Google’s first swing will be. The Pixel 6 is the first device to ship with an in-house “Google Tensor” SoC, and if Google’s theories about support timelines are correct, being able to jump to major kernel versions will be a big help in supporting lifecycles. Will get five years. Assuming the Pixel 6 ships with Linux kernel 5.10—which it was called several times in this talk—just this would be a vast improvement over the usual two-year delay—5.10 was released in December 2020.
image listed by SOPA Images / Getty Images