Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Debian 2.6 Kernel Compile How-To

A custom kernel compile is a very complicated procedure. Use this procedure only if there are no packages in the debian repository that can get your hardware/software configuration working for you. New users should read up on debian kernel compiles and kernel compiles in general before attempting this. This guide, its author(s), and/or contributors, are not responsible for any damage inflicted on your system by following these instructions. You compile and use a custom kernel at your own risk.



The following instructions detail a compile of a 2.6.xx kernel using The Debian Way. Please tell me if there are any errors/omissions, so that I can add them.


The following how-to assumes that you are running at least Debian 3.1, Sarge.


Step 1: Assuming that you have access to the internet and have installed a minimal debian install (netinstall iso), as root, type:


example:~# aptitude -r install kernel-package ncurses-dev fakeroot wget bzip2 kernel-tree-2.6.8 alsa-source


This should install all the packages required for a successful compile. The alsa-source package is to ensure that you sound works when running on your custom kernel.


Step 2 (Optional): If you do not want to use the debianized kernel, you can download a newer kernel from This is what is done next:


example:~# aptitude install ncftp

example:~# cd /usr/src
example:/usr/src# ncftp

ncftp / > cd pub/linux/kernel/v2.6/

ncftp /pub/linux/kernel/v2.6/ > get linux-

Transfer Complete!

ncftp /pub/linux/kernel/v2.6/ > bye
Save? (yes/no) no



Of course, use a mirror that is close to you (check for addresses on and grab the latest kernel version. At the time of this writing, it was


Step 3: Now untar the linux and alsa source packs, and make the appropriate symlink.


example:/usr/src# tar xvfj linux-

example:/usr/src# tar zvfj alsa-driver.tar.bz2

example:/usr/src# ln -s linux- linux


Step 4 (Optional): Edit the makefile.


example:/usr/src# cd linux
example:/usr/src/linux# nano Makefile


You may want to edit the EXTRAVERSION clause to insert something more descriptive. For example:


EXTRAVERSION = .11-pentium-m
NAME=Woozy Beaver


Step 5: Now comes the tricky part, kernel configuration. There are three ways to configure the kernel to suit your needs. Each will be described below.


example:/usr/src/linux# make config


This is the hardest way, and will present you with an almost endless stream of questions. Using this form of kernel compile assumes that you know exactly what you are doing. Answer one question wrong, and you have to start over. It is not recommended that you use this option.


example:/usr/src/linux# make menuconfig


This way is a lot easier, and will present you with a menu driven configuration interface in your console. You can select the configuration options you want, and when you are done, you can save your config file and proceed directly to a compile. An internel help system for each item is also available if you are unsure as to whether you need a component or not.


example:/usr/src/linux# make xconfig


This assumes that you have an X server available. The configuration interface is similar to that of menuconfig, but much easier to operate because it uses a graphical user interface. In debian, root cannot run X applications. Thus, after running this command, you have to run it again as a user.


user@/usr/src/linux$ make xconfig &


Personally, this guide recommends that you use menuconfig, and if possible, xconfig.


When you are done configuring using xconfig, you have to save your configuration file in your home directory, and then, using the root account, copy it to your /usr/src/linux directory.


example:/usr/src/linux# rm .config
example:/usr/src/linux# cp /home/user/myconfig .config


A few tips when configuring the kernel:


A. When a device driver is to be compiled into the kernel, it is designated by a star (menuconfig) or check (xconfig). When it is to be compiled as module, it is designated by an "M" (menuconfig), or round dot (xconfig).


B. Make sure that the IDE/SCSI and filesystem device drivers for your particular computer/root filesystem are compiled into the kernel. Otherwise your new kernel will not boot. This is done in "Device Drivers > Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support" and/or, "Device Drivers > SCSI device support", and "File systems" for filesystems.


For example, include support for IDE disk/cdrom/floppy support, along with ex3/reiserFS support, depending on which filesystem you use.


C. Make sure that the drivers for your particular graphics card is compiled into the kernel. Otherwise, you'll just get a blank screen. This is done in "Device Drivers > Character Devices" and "Device Drivers > Graphics support".


D. Compile all drivers for the hardware that is currently in use into the kernel. This will improve performance considerably. An exception to this is sound. All sound related components MUST be compiled as modules. Otherwise they will not work correctly.


Step 6: Now what we have all been waiting for, the kernel compile. After you have configured your kernel, and copied/moved the configuration file to the correct location (if using xconfig), type:


example:/usr/src/linux# make-kpkg clean

example:/usr/src/linux# time make-kpkg -revision -append-to-version -pentium-m kernel_image kernel_headers modules_image


Note: Multiple kernel compiles using the same source MUST use the same revision. The revision string, once set, cannot be changed. The -append-to-version option does the same thing as appending the EXTRAVERSION section in the makefile.


Now sit back and wait, this is going to take awhile. The time command is so that you can see how long it took for you to compile your kernel.


Step 7: If your kernel compiled successfully, it's time to install it. If it did not, go back and reconfigure the kernel, and repeat step 6. The following commands installs the completed debs. Obviously your files are going to be named differently.


example:/usr/src/linux# cd ..
example:/usr/src# dpkg -i alsa-modules- kernel-headers- kernel-image-



DO NOT uninstall your old kernel. You will most probably need it, since your newely compiled kernel will most likely contain fatal configuration errors.


Step 8: Now comes the moment of truth, the reboot. Type:


example:/usr/src# reboot


Select the new kernel from your grub bootlist. If the system successfully boots, congratulations. If it does not, (this is why you SHOULD NOT uninstall a kernel until you have verified that the new one works), boot back with the working kernel, reconfigure, and try again.


very nice howto shadowcat


i'd like to see you do more


well done





woot! debian needs more stuff here :)nice one...

Forum Jump:

Users browsing this thread: 1 Guest(s)