Getting the source

First you need to fetch the source. Visit and get the version of your preference. Alternative, if you plan to hack it you might prefer to get the latest (merged by Linus Torvalds) code by cloning his git repository:

git clone git://


After you decompress the fetched archive or the git clone is done, you will need to create a .config file for your build. You can either create a totally new .config file with make config or extract one from the running kernel with make localmodconfig. It is also possible to use some other targets (e.g. nconfig for a ncurses based configuration menu), for a full list try make help.

In order to keep the build directory completely separated from the source code, you should use make O=/path/to/build/directory. The path might be relative or absolute.

So, the easiest way to get going is:

make O=/path/to/build/directory localmodconfig

If the running kernel is older than the one you are trying to build you will probably be prompted to configure some newly introduced configuration parameters. It should be safe to just use the defaults for such case (i.e. just type enter).


To build the bare kernel and all modules run:

make O=/path/to/build/directory

This will take some time, so be patient. If you work on a multi-core machine you will probably want to use the -j argument to enable parallel compilation and reduce compilation time. You can also give a numeric argument to determine how many parallel jobs you permit, e.g., -j4.


To install the freshly built modules run:

sudo make O=/path/to/build/directory modules_install

To install the freshly built kernel run:

sudo make O=/path/to/build/directory install

Note, however, that the install target requires the presence of the installkernel script. In debian it can be found in the standard repositries. In archlinux it is not available so I modified the one provided by wdemoss in the archlinux forums, you can find this script here.

You should now be able to reboot and chose the freshly built kernel from your bootloader menu (grub or lilo).