Download and Unpack Your Shiny New Kernel Sources
Get the latest stable 2.6 kernel from The Linux Kernel Archives. Click on the “F” to get the complete kernel source. It’s a 32 MB download, and it unpacks to 172MB. Download and unpack it somewhere in your /home directory. The traditional way is create ~/src, and unpack it in there:
$ bzcat linux-2.6.3.tar.bz2 | tar -xvf –
Be sure to review the Documents directory. There are bales of good information in there. README gives installation instructions. Next, it’s a good idea to make printouts of your hardware information, you will need it. Make a hard copy of /etc/fstab, and print out the output of lscpi:
$ lspci | lpr
and dmesg:
$ dmesg | lpr
If the margins are too small, use lpr -o page-left=72 -o page-right=72 to set them at one inch.
Check your /usr/src directory for a .config file. There won’t be one if you’ve never compiled a kernel on the system. If it does exist, make a backup copy, because it’s going to be overwritten. Then run
$ make mrproper
This resets the source directory to a pristine state, giving our new kernel a clean start.
Configuration
First, find ../linux-2.6.3/Makefile and edit it. At the very beginning are these lines:
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 3
EXTRAVERSION =
NAME=Feisty Dunnart
Yes, the 2.6.3 kernel is really named Feisty Dunnart. What we want to do here is give EXTRAVERSION a unique value, so we can quickly identify this kernel. This can be anything, even -shiny-new-test-kernel, and after it’s all built and installed, the kernel name will look like this:
$ uname -r
2.6.3-shiny-new-test-kernel
We’re almost there. If you can’t wait for the next installment and want to leap ahead, keep in mind that almost all of the steps in building a kernel can, and should, be done as an ordinary, unprivileged user. Only two steps require root privileges: running make modules_install and editing the boot loader.
Resources
2.6.2 aka “Feisty Dunnart” release announcement
The Kernel-HOWTO
This article was originally published on CrossNodes.