Compiling a Custom Debian GNU/Linux Kernel

HIbernate

This section describes how the Debian GNU/Linux kenrel can be customized.

Increasingly, features in the kernel are moved out of the kenrel source tree and into userspace programs - this reduces the need for a kernel recompile. Further decreasing the need is the Debian repository offering kernel images for different platforms such as Intel® processor or AMD® processors. But occassionally, there are non-standard features or devices that need to be enabled in the kernel. The following describe how this can be done.

Warning note:The instructions below is a generic kernel compile and does not include patches Linuxvillage add to integrate products.

This disclosure is made in the spirit of Free Software so that users can help themselves and their neighbours. All material presented are licensed under The GNU Free Documentation License.

Please report problems and direct enquiries to Contact US.


  1. Prerequisite
  2. Getting the Kernel Source
  3. Configure the Kernel
  4. Compiling and installing the Kernel
  5. References

  1. Prerequisite

    To custom compile your Debian GNU/Linux kernel, you will need:

    1. A computer with Debian distribution Etch 4.0+,
    2. Initramfs-tools,
    3. Grub,
    4. root password,
    5. add user to the src group,
    6. Internet connection,
    7. free diskspace.

    Updated: 2007-06-14

    Back to top
  2. Getting the Kernel Source

    Launch the Synaptic Package Manager and search for linux-source. Mark it and the recommended and suggested packages. Press Apply to download.

    The debian linux-source package is different from the source from kernel.org; the debian linux source package is often a few version behind the official release and contains additional patches. The official release can be use as the kernel but it is outside the scope of this document. The Debian linux-source package has the Debian patches applied already. The debian source-tree is another animal but we won't discuss it.

    Updated: 2007-06-14

    Back to top
  3. Configure the Kernel.

    Select Application->Accessories->Terminal and Change directory into source, uncompress the kernel source file and create a symbolic link to it.

    $ cd /usr/src
    $ tar --bzip2 -xf linux-source-2.6.18.tar.bz2
    $ ln -s linux-source-2.6.18 linux

    Edit kernel-pkg.conf, to add maintainer, email and version information. You will need to SU to root prompt to accomplish that.

    $ su 
    # editor /etc/kernel-pkg.conf
    # exit
    ...
    # The maintainer information.
    maintainer := Linuxvillage.ca
    email := support@linuxvillage.ca
    ...
    # debian = $(version)-0.01.Custom
    debian = 10.03
    ...

    If you are compiling a kernel against the current running system, you can get a copy the running kernel's configuration as a starting point. Replace the name found in /boot directory. Change directory to source, initialize the environment and configure kernel.

    $ cp /boot/config-2.6.18-7-k7 /usr/src/linux/.config
    $ cd /usr/src/linux
    $ make menuconfig
    

    In menuconfig, select the appropriate options, * means in kenrel module and Mmeans loadable module. In kernel module means it is compiled into the kernel and loadable module means the module is loaded dynamically. Usually, in kernel module is needed only for things before initramfs is completed, e.g. PATA/SATA driver.

    You can also edit the .config file directly using your favourite editor.

    Updated: 2007-06-14

    Back to top
  4. Compile the Kernel.

    $ cd /usr/src/linux
    $ make-kpkg clean
    $ fakeroot make-kpkg --initrd --append_to_version -custom kernel_image modules_image

    Afterwards...the kernel and module package will be produced in /usr/src directory. If there are no errors, install the custom kenrel. Grub would be automatically updated.

    $ cd /usr/src
    $ su
    # dpkg -i linux-image-2.6.18-7-custom_10.03_i386.deb
    # exit

    That's it for kernel compile and configuring.

    Updated: 2006-06-14

    Back to top
  5. References

    • Grub originally designed and implemented by Erich Stefan Boleyn..
    Back to top