The Linux kernel is an extremely important part of the software on nearly every Android device. This section describes Linux kernel development and release models (below), stable and long-term supported (LTS) kernels (including why all Android devices should use stable releases instead of cherry picking patches), kernel configuration and hardening, requirements for interfaces and the modular kernels (introduced in Android O), kernel debugging and network testing, and SquashFS.
Linux kernel development
The Linux kernel is the largest collaborative software project ever. In 2016, over 4,000 different developers from over 450 different companies contributed to the project and there were 6 releases, each containing between 12,000 and 16,000 different changes. At the end of 2016 the size of the Linux kernel was just over 56 thousand files, consisting of 22 million lines of code, build scripts, and documentation (kernel release 4.9). (For full Linux development statistics, refer to https://kernelnewbies.org/DevelopmentStatistics.)
While the Linux kernel contains code for all the different chip architectures and hardware drivers it supports, an individual system runs only a fraction of the codebase. An average laptop uses around 2 million lines of kernel code from 5 thousand files to function properly, while the Pixel phone uses 3.2 million lines of kernel code from 6 thousand files (due to the increased complexity of an SoC).
Linux kernel releases
The Linux kernel uses a release model that differs substantially from standard AOSP releases. With the release of the 2.6 kernel in December of 2003, the kernel developer community switched from the previous model of having a separate development and stable kernel branch, and moved to a stable only branch model. In this model, a new release occurred every 2 to 3 months, and that release was declared stable and recommended for all users to run. This change in development model was due to the very long release cycle prior to the 2.6 kernel (almost 3 years), and the struggle to maintain two different branches of the codebase at the same time.
The numbering of the kernel releases began at 2.6.x, where x was an incrementing number that changed on every release (the value of the number has no meaning, other than it is newer than the previous kernel release). The kernel version since then has now moved to 4.x accounting for 2 major version changes. These version numbers are chosen by the maintainer(s) only to avoid confusion among users caused by higher minor release numbers.