Home > Desktop User > How to Compile an Ubuntu 8.10 Kernel

How to Compile an Ubuntu 8.10 Kernel

Compile a 8.10 Kernel

The purpose of this tutorial is to show you how to set up a kernel that is highly tuned for your CPU, in this case a dual core Pentium for a workstation.

Caution: If you do something wrong..it happens…be sure to reboot and select an alternative kernel. You should always have several kernels in case of trouble.

Step #1: Download and install the necessary tools.
Download the necessary tools so that you have everything ready.

# apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

You must have the source available to create a new kernel.

# apt-get install linux-source

You must be in the /usr/src directory to work or copy the source,
linux-source-2.6.27.tar.bz2, to the directory you want to work in. Either move into the /usr/src directory to work or into the alternative directory you will make the build in.

# cd /usr/src

This directory will contain the necessary headers to build the kernel. These are the source files.

You need to unpack the source that was downloaded.

# bzip2 -d linux-source-2.6.27.tar.bz2
# tar xvf linux-source-2.6.27.tar

Now you should have a directory that looks like this:

linux-source-2. 6.27

Create a symbolic link to this source directory and name it linux.

# ln -s linux-source-2.6.27 linux

Move into the directory, you can use the term linux as it is now a link to that folder.

# cd linux

The config file is a hidden file that has the configuration from the kernel that is installed. You will need to copy that because it has already determined your hardware devices.

# cp /boot/config-`uname -r` ./.config

When you copy this config file over, it is a file represents the hardware that the kernel discovered at boot and set up. It also reflects many default settings.

Step #2: Now the fun begins….

You are ready to start menuconfig which will allow you to choose your kernel specifics.

make menuconfig

This opens the menu to start configuration.

Here you see it detected the .config file.


Now work your way through the menus and make the selections that you want to add or subtract. For example, here Reiserfs was originally a module that could be added, it had a “M” to indicate module that could be loaded. Bu it has been unchecked so modular support will not be available, thus saving space in your kernel. The “*” indicates that it will be loaded into the kernel and an empty option means that no support for that option will be placed in the kernel.


Once you have all of your modifications complete save the new .config file.

Run this command to clean up.

# make-kpkg clean

The next thing you want to do is create a kernel extension so that as you make kernels you are able to tell the versions apart. What I usually do is place my initials and a number so that I can keep track.

# fakeroot make-kpkg – -initrd – -append-to-version=-mw1 kernel_image kernel_headers

After –append-to-version= you write a string that will help you keep track of your kernel changes, it must begin with a minus (-) and must not contain whitespace.

This will take awhile.

After the successful kernel build, you can find two .deb packages in the directory you built the kernel in. If you were located in the linux directory, look in the directory above for the two .deb packages.

Now you can install and create .deb files so you can take your kernel to another machine with similar hardware. Run these commands as root in order to install them into the boot directory and modify your /boot/grub/menu.lst.

# dpkg -i linux-image-

# dpkg -i linux-headers-

You should now be able to select and test the new kernel when you reboot.

Now when I look in /boot/grub/menu.lst I see listed my new kernel:

## ## End Default Options ##

title Ubuntu 8.10, kernel
uuid 9c297074-83fe-41d2-b0d5-9e2e043028e5
kernel /vmlinuz- root=UUID=b1c96812-724b-407d-a8b4-9aad3628540e ro quiet splash crashkernel=384M-2G:64M@16M,2G-:128M@16M
initrd /initrd.img-

title Ubuntu 8.10, kernel (recovery mode)
uuid 9c297074-83fe-41d2-b0d5-9e2e043028e5
kernel /vmlinuz- root=UUID=b1c96812-724b-407d-a8b4-9aad3628540e ro crashkernel=384M-2G:64M@16M,2G-:128M@16M single
initrd /initrd.img-

title Ubuntu 8.10, kernel 2.6.27-7-generic
uuid 9c297074-83fe-41d2-b0d5-9e2e043028e5
kernel /vmlinuz-2.6.27-7-generic root=UUID=b1c96812-724b-407d-a8b4-9aad3628540e ro quiet splash crashkernel=384M-2G:64M@16M,2G-:128M@16M
initrd /initrd.img-2.6.27-7-generic

Caution: You will need space in the /boot directory to save kernels as you build them. I typically build my /boot directory with 500 MBs of space.


Edit your timeout in the /boot/grub/menu.lst and increase it when you are building and trying kernels. That way it will not fly by so fast.

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout 8

Comment out the hiddenmenu so that you will see the menu on boot. For more info check out our Building Linux Kernels online course.

  1. Bobo
    December 14, 2008 at 3:37 pm

    many thanks for your good how-to! 🙂

  2. walter
    December 22, 2008 at 1:27 pm

    that you for the post. however, how do i add modules? I can’t get ibex to recognize my wireless so I run it at the previous kernel which works fine. But due to the new way that wireless is used it bailed on my card (Proxim Gold). It looks like I need to specify some files to the kernel before it bakes it. Any suggestions or links appreciated. thanks

  3. Scott
    December 30, 2008 at 1:36 am

    the ln -s linux-source-2.6.27 linux created a broken link…

  4. Scott
    December 30, 2008 at 1:38 am

    Nevermind… My bad.

    Maybe you could mention that people should use “sudo” before they untar the file. It would REALLY help us new users who are looking to explore Linux in more detail.

  5. Scott
    December 30, 2008 at 1:51 am

    This tutorial doesn’t show anything but how to download and decompress linux kernels. LOL.

  6. January 1, 2009 at 10:40 am

    If you are using apt-get and downloading the kernel from the repository, the command apt-get will do all of the decompressing of the kernel.

  7. disappearedng
    January 19, 2009 at 1:25 pm

    Hey great tutorial man.

    I am just wondering, after compiling the kernel, what can I remove from my /usr/src?

    for example, I used disappearedng1 instead of mw1 and this is the output of ls under /usr/src

  8. Corné
    January 21, 2009 at 11:25 am

    use the two files that end on Custom_i386.deb

  9. Corné
    January 21, 2009 at 11:27 am

    fakeroot make-kpkg – -initrd – -append-to-version=-mw1 kernel_image kernel_headers

    should be:

    fakeroot make-kpkg –initrd –append-to-version=-mw1 kernel_image kernel_headers

  10. Nina
    January 28, 2009 at 11:25 am

    Thank you for the great tutorial! I have ubuntu 8.04 Hardy Heron, and these instructions worked just as fine to get a bootable kernel. But my sound and wireless don’t work. 😦 I know that my system uses restricted drivers, so do I need to reinstall a new mad wifi?

  11. Nina
    January 28, 2009 at 11:41 am

    actually, I retrieved the source a little differently:

    # apt-get install linux-kernel-devel build-essential
    # apt-get build-dep linux-ubuntu-modules-$(uname -r)
    # apt-get source linux-image-$(uname -r)

    but the compile process (make menuconfig, make-kpkg, dpkg -i) were all the same.

  12. Raton
    January 31, 2009 at 8:17 am

    Excellent how-to! Thanks a lot dude!

  13. hooverdn
    February 12, 2009 at 11:19 pm

    When I do this, the

    dpkg -i linux-xenu-

    prints a message:

    Please manually create an initrd image

    There is no initrd.img- in /boot (there is only a System.map and a vmlinuz for my build) and there is no entry in /boot/grub/menu.lst for my build.

    How do I create the initrd.img and the other files in /boot for my image?

    Should I just manually create the entry in /boot/grub/menu.lst once I have them?

  14. Shawn
    February 17, 2009 at 10:26 pm

    Great how-to! Easiest one to follow for 8.10 kernel builds yet.

  15. confused
    March 4, 2009 at 6:42 pm

    When I attempt to install a custom compiled kernel (2.6.28.X) from debs on my system, I get the following error:

    dpkg: error processing linux-image- (--install):
    trying to overwrite `/lib/firmware/atmsar11.fw', which is also in package linux-image-
    dpkg-deb: subprocess paste killed by signal (Broken pipe)

    Here is the complete log:
    $ sudo dpkg -i linux-image-
    [sudo] password for squishy:
    (Reading database ... 144190 files and directories currently installed.)
    Unpacking linux-image- (from linux-image- ...
    dpkg: error processing linux-image- (--install):
    trying to overwrite `/lib/firmware/atmsar11.fw', which is also in package linux-image-
    dpkg-deb: subprocess paste killed by signal (Broken pipe)
    Running postrm hook script /sbin/update-grub.
    Searching for GRUB installation directory ... found: /boot/grub
    Searching for default file ... found: /boot/grub/default
    Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
    Searching for splash image ... none found, skipping ...
    Found kernel: /boot/vmlinuz-
    Found kernel: /boot/vmlinuz-2.6.27-11-generic
    Found kernel: /boot/memtest86+.bin
    Updating /boot/grub/menu.lst ... done

    Errors were encountered while processing:

    I know that I can remove my current functional linux-image through dpkg and then I can install the new one, but I’d like to keep both on the system.

  16. March 5, 2009 at 7:51 am

    What user are you when you do this, a regular user cannot write to the /boot directory.

  17. confused
    March 5, 2009 at 5:29 pm

    I used sudo so it was root.

  18. March 5, 2009 at 10:41 pm

    What is the disk space on your /boot directory.


    That should show you.

  19. confused
    March 6, 2009 at 4:46 pm

    My /boot in on the same partition as / which has gigs and gigs free… it’s not a freespace issue.

  20. March 9, 2009 at 3:40 am

    thanks 4 the nice article

  21. Babu
    March 18, 2009 at 12:06 pm


    I tried as mentioned in this guide.

    I am running into the following issue when I reboot:
    Gave up waiting for root device. Common problems:
    – Boot args (at /proc/cmdline)
    – Check rootdelay = (did the system wait long enough?)
    – Check root = (did the system wait for the right device?)
    – Missing modules (cat /proc/modules; ls /dev)
    ALERT! /dev/disk/by-uuid/BA046C9D046C5E7F does not exist. Dropping to a shell!

    BusyBox v1.10.2 (Ubuntu 1:1.10.2-1ubuntu6) built-in shell(ash)

    Enter ‘help’ for a list of built-in commands

    Could you please let me know how to solve this ?


  22. lolwhites
    March 20, 2009 at 12:01 pm

    I get as far as fakeroot make-kpkg – -initrd – -append-to-version=-mw1 kernel_image kernel_headers and get this message:

    Error: Unknown target –initrd Unknown target –append-to-version=-2.6.27-14-lw-20090320
    use –targets to display help on valid targets

    Please advise

  23. Willie
    March 21, 2009 at 8:17 am

    Thanks for the great howto. The only problem that I have is that on boot up it says “error: “kernel.maps_protect” is an unknown key”. It doesn’t seem to effect anything so I am just going to go with it.

  24. March 29, 2009 at 11:26 pm

    That’s a very good guide.

    I got some errors when building on AMD64 machine. The error saying can’t open files under arch/xen/

    I Added “–arch=x86_64” and the error resolved.

    fakeroot make-kpkg –initrd –append-to-version=-mw1 kernel_image kernel_headers –arch=x86_64

  25. April 5, 2009 at 5:19 pm


    Thank you for ur great tutorial.


    1. Downloading the kernel source code,uncompressing it, configuring the kernel, and building it should be done as a normal user on the machine.

    Only the two or three commands it takes to install a new kernel should be done as the superuser (root)

    2. Do not do any kernel development under the /usr/src/ directory tree at all, but only in a local user directory where nothing bad can happen to the system.

    exp.: mkdir ~/linux


  26. G&T
    April 9, 2009 at 5:47 pm

    For Debian systems the best way to go is by using Kernelcheck

  27. Elliott
    June 1, 2009 at 2:32 am

    I have the same problem as “Hooverdn” above? I guess the –initrd option is supposed to create the initrd imagine. Don’t really understand it. Anyone, know how to fix this.

  28. June 11, 2009 at 12:16 am

    You need to do exactly what it says “Please manually create an initrd image”
    In another words create a ramdisk for new kernel. “man mkinitrd”
    If mkinitrd command does not exist install “initrd-tools”
    Then edit /boot/grub/menu.lst and replace/add your new ramdisk and karnel.

  29. vnv srikanth
    July 10, 2009 at 4:00 am

    (1)For getting initrd image download initramfs-tools
    # sudo apt-get install initramfs-tools
    (2)give the following command for building the initrd image
    # update-initramfs -c –k (version( is the directory name which appears
    in /lib/modules/ after installing modules)
    (3)initrd image will be generated /boot/ directory

  30. Howard
    September 29, 2009 at 6:49 am

    Got the same error as Babu above (March 18)

    ALERT! /dev/disk/by-uuid/BA046C9D046C5E7F does not exist. Dropping to a shell!

    Please help if you can.

  31. December 16, 2010 at 11:17 am

    I am continually searching online for articles that can facilitate me. Thank you!

  1. December 4, 2008 at 12:39 pm
  2. December 20, 2009 at 12:06 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: