Compiling the Linux Kernel

Printer-friendly versionSend to friendPDF version

This page last updated on 6 December 2008

Guide(s)

Here are my notes from attempting to compile kernel 2.6.27.8.
Hardware: Compaq Evo N410c, Pentium III (1 ghz, 512MB), 2GB free on 10GB hard drive
OS: Ubuntu Hardy Heron (8.04)

At first I followed this NixCraft tutorial. It didn't work for me, but I had better success with the Ubuntu KernelCompile documentation.

Notes

NixCraft claimed the whole process would take 60-90 minutes. I didn't believe it, and it took much longer. Choosing the particular configuration (browsing menu-config or xconfig) can take an hour or more. Compiling on this hardware took around 2-2.5 hours. I went out for coffee, so ... I don't know how long it actually took. =)

Requirements

I had to stop and fix/check the following along the way:

  • enough hard drive space (1GB was tight; 1.5-2 was sufficient; 600MB is too little)
  • working net connection
  • gcc compiler (use synaptic)
  • ncurses dev toos (use synaptic; libncurses?-dev)
  • make needs rights to browse about the system. I used sudo, but this is dangerous.
  • gconfig needs gtk+. I have this, so I don't know why the make wouldn't work

Get the code

I downloaded the current kernel from kernel.org. After failing with the NixCraft way (running an installer ...), I made debian packages as described by the Ubuntu docs. This made installation straightforward.

Work space

NixCraft also suggested running make from usr/src. Didn't work for me, so I put the code in ~/kernel/src. In that directory I ran make, and it was happy.

Config files

I tried each config interface (menuconfig, xconfig, gconfig). Each program provides the same info and results. Most important, they briefly describe each of some few hundred settings. It's also possible to import an existing config for recompilation/update, or export the current config.

Results

After making the kernel packages (two), I installed them with dpkg. My first few kernels crashed out - I think I made more than a few poor choices in the config.

I eventually went back to the Ubuntu config file, imported that to menuconfig, and then changed things from there. I had good success with this and ended up with a custom kernel for my hardware.

On the down side, I use an Atheros wireless card. The drivers for this card are not public, so I use the restricted madwifi package. Unfortunately, I have to learn to recompile that package for my custom kernel [sigh].

I'll keep at this project and then write more notes. Long term, I hope that I get good enough at the process to cross-compile for ARM and put a kernel on my Palm Tungsten E.