This page is out of date. Please use the main navigation to find the latest documentation.
[originally published on aligunduz.org and copied here by the author]
You will need to install packages needed for kernel compilation. First, make sure your apt database is updated
Install the needed packages
apt-get install fakeroot kernel-package libncurses5-dev libqt3-mt-dev bzip2 wget build-essential
Go to Linux-libre release page and find out the url of the source pack (the .tar.bz2 file) you want to build. Download the source pack to your /usr/src/ directory.
For example, for Linux-libre 18.104.22.168 you would enter
Uncompress the archive file
tar xvjf linux-22.214.171.124-libre.tar.bz2
Go to the newly created directory of the uncompressed source
make clean mrproper
Now, you will need to have a base .config file that will control the build process. If you don't have a specific .config file, you can use the default file in the /boot directory. Just copy that into the source directory.
cp /boot/config-uname -r ./.config
Now, you can review and change config variables. First, update your config file to the new options of the kernel source
and answer the configuration questions there. Enter yes for the module to be built into the kernel, m for it to be build modularly which will only load if needed and no to exclude the module. You can also enter ? to get information about the module. However, you don't have to worry too much as you will be able to revise your decisions in the next step.
(make menuconfig is an alternative .config editing tool)
This will open an application that classifies and explains the properties and available modules you can either 'build into' the kernel, make modularly available or disable. When you are done, save it and exit.
Now, you can build your kernel. First enter
As the final command, enter
fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
You can change --append-to-version= value with anything as long it starts with - (minus sign) and has no whitespace in between. Optionally, you can add kernel_source at the end, if you want to build a source pack. You can also put CONCURRENCY_LEVEL=N (where N should be replaced by the number of CPU cores your computer has) at the beginning of the command to make the building process take advantage of multiple core systems.
The last command will take some time to complete. At the end, you will have linux-image and linux-headers (and linux-source if you chose) installation files.