androidandroid-kernel

How does the kernel that ships with a device differ from the Android Common Kernel?


I'm curious to know what changes are made to the Android Common Kernel before the final version of a device's kernel is built.

Secondly, I'd like to know if there are any devices that could run an unmodified Common Kernel.


Solution

    1. The changes made to the Android Common Kernel before being shipped on a device are typically done by two organizations: the SoC manufacturer (most commonly Qualcomm) and the device manufacturer. The SoC manufacturer adds drivers for the SoC, and may modify the kernel in other ways to use these drivers. The device manufacturer modifies the kernel to add any additional drivers (such as for the display, touchscreen, etc.) and also to create device tree source files that specify what hardware is in the device, and how the hardware in the device is connected. Additionally, the manufacturer can modify the kernel however they want to. Typically this is done to add support for special software "features" (which certain OEMs like Samsung are known for), or to add support for new kinds of hardware - which may have been necessary for the first Android devices with things like fingerprint readers, display cutouts, or foldable screens.

    2. Yes, there are devices that can run the Android Common Kernel. The Android Common Kernel is just a fork of the mainline Linux kernel. Therefore, if a device's drivers and device tree are in mainline Linux, then the Android Common Kernel should run on it. Let's be more specific though. When it comes to Qualcomm SoCs, the Snapdragon 410, 450, 625, 630, 632, 636, 808, 810, 820, 835, 845, 850, 855, and 865 all have some amount of support in Linux kernel v5.12 (though this is not a conclusive list). This means that any Android device with one of those SoCs and a device tree in mainline Linux could theoretically boot the mainline kernel, and thus the Android Common Kernel. So, which Android devices actually have device trees in Linux 5.12? There are too many to list here, but here are a few: Google Nexus 6P, Samsung Galaxy A5, Xiaomi Poco F1, OnePlus 6T, Sony Xperia Z5. The device tree source files for these devices and their SoCs can be found in linux/arch/arm64/boot/dts/qcom/.