Linux Kernel Versions#
- Linux kernel comes in two flavors: stable and development.
- New stable kernel versions are released only to fix bugs and security issues. Development versions undergo rapid changes and include new features.
Kernel Versioning Scheme#
Historically,
- Linux kernel versions are numbered in the form
X.Y.Z, where:Xis the major release number.Yis the minor release number.Zis the revision number.
- Sometimes, an additional fourth number
Wis added, which is the stable version number. - Minor releases also determine whether the kernel is a stable or development version:
- If
Yis even, it is a stable release. - If
Yis odd, it is a development release. Example:2.6.30.1is a stable release, while2.5.45is a development release.
- If
- Development kernels stablize over time, for example, series
1.3stablized into2.0, and2.5stablized into2.6.
After 2.6 series,
- After an invite-only Kernel Development Summit in 2004, the versioning scheme was changed,
and the kernel developers decided to prolong the
2.6series and postpone the introduction of2.7development series. - Instead, the development cycle of each
2.6revision grew longer, each release incorporating a mini-development series. - To compensate for the reduced frequency of releases, the kernel developers introduced
the stable version number
Was the fourth number in the versioning scheme, which contain only bug fixes and security patches. And these are often backported from the under-development kernel. Example: Release2.6.32.8is the eighth stable release based on the development kernel2.6.33. - This allows the previous releases to receive attention focused on stabilization.
Linux Mailing List(lkml)#
- This is the mail forum where kernel development is discussed.
- It is a high-traffic list with thousands of messages per day.
- Subscriptions are free and open to anyone: https://vger.kernel.org.
- Here is an archive of the mailing list: https://lkml.org.
- Since, its a high-traffic list, Linus and other kernel maintainers often get thousands of emails per day. So, they are not open to dealing with nonsense.
- This is where you will find testers, developers, peer reviewers while developing new features or fixing bugs.
Kernel Setup and Configuration#
Get the latest code from Linus’s tree:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.gitor get the tarball from the website and uncompress it:
- bzip2 format:
tar xvjf linux-x.y.z.tar.bz2 - GNU zip(modern):
tar xvzf linux-x.y.z.tar.gz- bzip2 format:
NOTE: The kernel source lives in
/usr/src/linuxin your system. Avoid directly making any changes to it, even when installing new kernel.
Configure the kernel:
Configure kernel before building it. The configuration lives in the
.configfile, in the root of the kernel source.Configure options are either booleans(yes or no) or tristates(yes, no, or module).
A module setting in tristate represents a config option that is set but is to be compiled as a module(separate dynamically loadable object).
Drivers are usually represented by tristates.
These options do not control the build process, they just specify values that kernel source can access as a preprocessor macro.
Kernels such as those provided by Canonical for Ubuntu or Red Hat for Fedora, are precompiled as part of the distribution. Mostly these enable a good cross section of the needed kernel features and compile nearly all drivers as modules.
To configure the kernel one option at a time run:
make configNOTE: This can get very tedious.
Better ways to config:
- Use a TUI menu
make menuconfigNOTE: This is what I use.
- Or a gtk+ based graphical utility:
make gconfigSometimes, you just want things to be up and running with a default config file:
make defconfigValidate config before proceeding:
make oldconfig
Build the Kernel
- Simple
make- Using multiple jobs to speed up compilation:
make -jNwhere
Nis the number of threads to use.NOTE: Using
make -j$(nproc)uses all available cores.Install the Kernel: Depends on architecture and bootloader. Here I will cover installation for x86 systems using GRUB bootloader.
- Install modules first: Installs modules to
/lib/modules
sudo make modules_install- Install the kernel:
sudo make install- This will copy the kernel image to
/bootand update the GRUB config file located at/boot/grub/grub.cfgor/boot/grub2/grub.cfgdepending on your distribution. - Reboot the system to use the new kernel.
- Install modules first: Installs modules to
References#
- Linux Kernel Development (3rd edition) by Robert Love.