The UHF of the film world.
Latest news

quietearth [General News 09.15.06]

Here's a very dirty how to to build a custom kernel for ubuntu. This does not cover propietary drivers such as nvidia or ati. If you are using any propietary video drivers, you will need to modify your xorg.conf, otherwise X will not work when you boot into the new kernel. More detailed instructions are available at the link on the bottom of this post.

# apt-get install ncurses-dev kernel-package linux-source build-essential
# cd /usr/src
# bzip2 -dc linux-source-2.6.15.tar.bz2 |tar xf -
# cd /usr/src/linux-2.6.15

Now lets get our running kernel version and copy over the appropriate config file.
# uname -r
# cp /boot/config-2.6.15-26-386 .config

Now let's configure it, run the following and then set and save your options.
# make menuconfig

Now lets use make-kpkg to compile the kernel and it will produce an installable .deb for us:
# make-kpkg clean
# make-kpkg --initrd --append-to-version=custom1 kernel_image kernel_headers

One problem I ran into while compiling the kernel source was errors in the prism54 wireless driver code. I had to completely remove support to get the kernel to compile.

Now after this is done compiling we can look in /usr/src and we have the following packages:

And we can install with:
# dpkg -i kernel-image-

After installation, your custom kernel will be at the bottom of the grub's list, so it will not be automatically booted. You will either need to move it to the top of the list in /boot/grub/menu.lst or manually stop autoboot in grub and specify booting your new custom kernel.

To remove the kernel, you will have to boot into another kernel otherwise you might destroy your system.
# dpkg -r kernel-image-

A more detailed article is available at .

Tested under dapper.

You might also like


Hilden (14 years ago) Reply

As far as i could see, all these options were build into the kernel on my Feisty.


J (14 years ago) Reply

Every distro has their own little best practices for compiling a kernel so thanks for this. Are you sure the kernel package in kernel-source will be patched the same way as the shipped kernel?


quietearth (14 years ago) Reply

If you run dpkg -p [packagename] where packagename is linux-source[...] you will see it's the kernel source with ubuntu patches applied, so yes.


Jim (14 years ago) Reply

Thanks for this page, works great for me. Simple, to the point. Traditional make, make_modules, make modules_install doesnt work anymore. :-( initrd is required now on 2.6 ? Eeeks!


ghantoos (13 years ago) Reply

Great post! Straight forward & clear! I like it!

Thanks a lot!


cherry316316 (9 years ago) Reply

i by mistake initially installed kernel in ubuntu using make command and didnt created .deb file. now i want to remove that image of kernel and since i didnt created .deb file, i dont see the header in synaptic. what is the best way i can remove kernel which i installed using make command? thanks

Leave a comment