User Tools

Site Tools


Compiling the Linux Kernel

Get a kernel:

$ wget


$ tar xjf linux-2.6.30.tar.bz2
$ cd linux-2.6.30

Make a .config file. 99% of the time the default will be fine, so we'll just run the plain menu config and exit to save the defaults. (You might be tempted to do "make defconfig", which claims to do the same thing, but it doesn't.)

$ make menuconfig
<menu appears, choose Exit>
<Do you want to save the config?  Yes>

If you're going to be modifying the kernel, you should append something to the kernel version to differentiate it from "pure" kernels. To do this, in the menuconfig, select "General setup", then "Local version - append to kernel release", then type something to append, such as "-tyler1". That way, your kernel image and drivers will will be installed with the version string 2.6.30-tyler1.

Compile the kernel and modules. If your system has more than one core, use the -j option to run multiple jobs in parallel – use twice the number of cores. So for our 8-core machine:

$ make -j 16
<A ton of output>

Copy the kernel modules to their rightful place (/lib/modules/<kernel_version>):

$ sudo make modules_install

You can install the kernel and related stuff to /boot and update the grub menu automatically on most distributions:

$ sudo make install

You should now be able to reboot and choose the new kernel.

how_to_compile_the_linux_kernel.txt · Last modified: 2010/12/03 23:33 by tkbletsc