User:Maffblaster/Drafts/Kernel hacking

This guide describes some of the steps necessary to use Gentoo Linux to hack on (develop) the Linux kernel. Since most Gentoo systems already compile their own kernels, only minimal steps are necessary. These mainly consist of installing git (not included by because in Gentoo), cloning the Kernel sources, checking out a tag,

Emerge
Most of the needed tools are already installed on the system, however a few extras will be needed for Kernel hacking. Make sure the main Gentoo repository has been synced for the newest ebuilds, then execute the following command:

Kernel sources
As explained on Kernel.org, there are several categories of kernel releases. From fresh to stale:


 * 1) Prepatch - Also known as release candidates, prepatch kernels must be tested.
 * 2) Mainline -
 * 3) Stable - Stable sources are released mainline sources.
 * 4) Longterm - In Longterm releases important bug fixes are applied. These sources are mainly to support systems running old kernels and are not meant for development.

For the purposes of this guide stable sources will be used as the example sources.

The kernel sources are quite large. Depending on connection speed and computing power it could take a significant amount of time to complete a clone. Be patient.

Stable
The next step is to clone the stable kernel sources using :

Release candidate
It is also possible to use release candidate sources. As one would think, the release candidates are less stable than the stable sources mentioned above, but they can be cloned if desired. Release candidate sources contain newer source code:

Selecting a version
Linux kernel developers use a feature in called tagging in order to keep track of kernel

The .config file
Gentoo-based distributions have an advantage over other distributions: they build their kernels on each kernel upgrade. If the system is running well simply copy the kernel's .config file from the directory to the directory containing the new kernel sources.