In the past few weeks, we’ve made a lot of posts about official Android 11 updates and Android 11-based custom ROMs. There is even a special custom Generic System Image (GSI) build through which anyone can get the taste of Android 11 on their Project Treble compatible devices. However, a similar achievement has yet to be made in the domain of generic kernel development.
If every hardware component of a particular Android smartphone can be upstreamed to the mainline Linux kernel, the device should be able to boot any regular GNU/Linux distribution with no additional changes, which also makes it a lot easier to keep up with newer AOSP versions.
Like all Android devices, 2015’s Sony Xperia M4 Aqua runs on a modified Linux kernel. Google usually takes a mainline Linux kernel release and then modifies it to support the latest Android release at that time – they call this the “Android Common Kernel”. Chipset makers (in this case, Qualcomm) then take the Android Common Kernel and modify it further to make an SoC-specific kernel. OEMs/ODMs (like Sony) then take the SoC-specific kernel and make further changes to support their hardware or extra vendor components – we call this a device-specific kernel.
Because the Linux kernel is distributed under the GNU GPL v2 license, all entities that distribute forks of the kernel (which includes Linux kernel blobs shipping on commercial devices) are required to provide the source code for their kernel upon request.
Sony did release the kernel source code for the Xperia M4 Aqua (code-name “tulip”) based on Linux Kernel 3.10, but considering the fact that the phone is too old to support Project Treble, the official source tree is just not enough to port modern versions of Android (or any Linux distribution) to this device.
Pavel, who has also contributed to the postmarketOS project, has created a custom device tree from scratch for the Xperia M4 Aqua to enable mainline Linux Kernel support (note that “mainline” here and Google’s own “Project Mainline” are not related). The developer has also uploaded a ready-to-flash AOSP 11.0 build for this phone, which ships with the precompiled Linux Kernel 5.9 RC7.
As of now, many hardware-specific features are lacking in the ROM, but that is alright as we are still in the early days and these features will be fixed on the source side over time. We hope the official support for nearly all critical hardware components in the Linux kernel will pave the way for future versions of Android, and other Linux kernel-based operating systems, to be ported to the Xperia M4 Aqua and similar other devices. If you want to learn more, check out the XDA thread linked below.