Linux Kernel Development Model

Linux Kernel

It is a result of collaborative development efforts from developers across the globe.
Small incremental changes also known as patches include:

  1. New Features
  2. Enhancements
  3. Bug Fixes

Q: How frequent is the Kernel release?
A: A release happens every 2 to 3 months. They are time based rather than feature based, which means releases are not held up for features.

Developers, Maintainers in Linux Kernel

Most parts of the kernel have associated maintainers. Maintainers are individuals who is in charge of specific parts of the kernel.
Eg:

  1. Each individual driver has an associated maintainer
  2. Each kernel sub-system for example networking sub-system also has an associated maintainer. Sub-systems may have multiple maintainers.Subsystem Examples:
    a. Memory Management
    b. Networking
    c. Scheduling
    d. USB
    e. PCI

5.9 : under MAINTAINERS, you will find the list of maintainers and how to submit kernel changes.

These maintainers decide which patch goes to the mainline kernel. The maintainer for a specific driver or subsystem is usually listed in the file MAINTAINERS, which is also located in the root of the kernel source tree.
There are special types of maintainer known as kernel maintainer. They manage the kernel tree.

Linux Kernel Trees

A Linux kernel source-tree is a directory which contains all the kernel source. You can build a new kernel, install that, and reboot your machine to use the rebuilt kernel.
Tree : You can find the tree structure here

Mainline Kernel Tree

Maintained by Linus Torvalds.

  • The tree where Linux releases mainline kernels and RC releases.

Stable Tree

Maintained by Greg Kroah-Hartman

  • Consists of stable release branches.

Linux-next Tree

Maintained by Stephen Rothwell

  • Before updates from subsystem trees are merged into mainline tree, they need to be integration-tested.
  • Used for integration testing.
  • It contains the latest version of staging tree

Staging Tree

  • Used to hold stand-alone drivers and file systems that are not ready to be merged into main portions of the Linux Kernel tree at this point due to coding standard or quality issues.
  • Location: drivers/staging

Submitting Patches

  • The development process happens entirely over the emails.
  • Every kernel subsystem has a mailing list.
  • Patches touching a specific driver/subsystem, are sent to the maintainer listed in MAINTAINER.
  • The MAINTAINER file consists of subsystem git information and mailing lists for each subsystem.
  • Contributors send patches to the mailing lists through email.
  • While sending the patch, carbon copy (CC) to linux-kernel@vger.kernel.org (Linux Kernel Mailing List)
  • Subject:
    “[PATCH] brief description”
  • Body:
    Technical Details of your changes patch makes and reasons behind those changes
    Attach Kernel Version to the email.
    Attach the patch as plain text.

NOTE:

  • If the patch is large or contains several logical changes, you should break the patch into chunks with each chunk representing a logical changes.
  • Each Email should send one patch

Linux Kernel Release Cycle

  • Linus Torvalds releases a new kernel and opens a 2-week merge window
  • Subsystem maintainers collect patches ahead of time and send them to Linus during the merge window.
  • Nearly 10,000 patches gets pulled into Linus’s tree during these 2 weeks.
  • At the end of two weeks, Linus declares the merge window has closed and releases the first release candidate known as rc1.
  • At this point, the release cycle moves into a bug fixes-only mode, with a series of release candidates (RC) from Linus.
  • Every week a new RC is released with name 5.9.rc1, 5.9.rc2 and so on.
  • Finally after the end of these RC weeks the kernel is stable and ready for release as version 5.9.
  • The whole development is a matter of 10–12 weeks and get a new version in every three months.

Linux Kernel Chain

Linux Kernel Chain

Image of Kernel Release Cycle

Kernel Release Cycle

Types of Releases

  1. PrePatch / RC :
  • Mainline kernel pre-releases
  • Contains new features which must be tested before they can put into stable release.
  • Maintained and released by Linus Torvalds
  • GIT

2. Mainline :

  • Maintained by Linus Torvalds
  • Tree where all the new features are introduced
  • New mainline kernels are released every 2–3 months.

3. Stable :

  • After every mainline kernel is released, it is considered “stable”.
  • Any bug fixes for a stable kernel are back ported from the mainline tree and applied by a designated stable kernel maintainer.
  • Stable kernel updates are released on as-needed basis, usually once a week.
  • There are usually only a few bug fix kernel releases until next mainline kernel becomes available.

4. Long term :

  • Stable releases are selected for long term maintenance to provide critical bug fixes for older kernel tree.
  • Kernel Releases

Q: How long the stable kernels are maintained ?
A: Stable kernels are maintained for as long as the current development cycle is happening. After Linus releases a new kernel, the previous stable kernel tree is stopped and the users must move to the newer released kernel.

Need for Long Term Kernel Release Model

Many different users of Linux wanted a kernel to be supported for a longer than just a few months.
Originally, it was merely based on what kernel the stable maintainer’s employer was using for their product (2.6.16.y and 2.6.27.y)

Current Selection: Last kernel of the year is selected as LTS

Linux Kernel Releases

Releases

Linux Versioning

Mainline Kernels: x.y
Stable Kernels: x.y.z

Which Kernel To Use (Priority)

Which Stable Kernel Should I use

  • Supported kernel from your favorite Linux Distribution
  • Latest Stable Release
  • Latest LTS release
  • Older LTS release that is still being maintained

Where To Find Linux Kernel Sources

  • All the source code for the Linux Kernel can be found here
  • Linus Tree can be found here

Fetching Mainline Sources

$ mkdir linux_mainline
$ cd linux_mainline
$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Fetching Stable Kernel Sources

$ mkdir linux_stable
$ cd linux_stable
$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Distribution Kernels

Many linux distributions provide their own “longterm maintenance” kernels that may or may not be based on those maintained by kernel developers.
These kernels are not hosted at kernel.org and kernel developers can provide no support for them.

How to find if my kernel is a distribution kernel or not?

Unless you downloaded, compiled and installed your own version of kernel from kernel.org, you are running a distribution kernel.

Check you Linux kernel version

uname -r
5.0.0-32-generic

NOTE: If you see anything at all after the dash, you are running a distribution kernel.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store