Step by Step tutorial howto compile kernel in Debian 5.0 (Lenny)

This tutorial will explain Howto compile kernel in Debian 5.0.The default kernel that comes with Debian is better suited for servers . It’s optimized for high thoughput and low interactivity. When you compile your own, you can among other things optimize it for the processor(s) you have.

Preparing Your system

First you need to install the following packages

#apt-get install kernel-package ncurses-dev bzip2 module-init-tools initramfs-tools procps fakeroot

If you plan on using the graphical configuration tools, gconfig or xconfig, you’ll need additional packages, respectively libgtk2.0-dev libglib2.0-dev libglade2-dev for gconfig or libqt3-mt-dev for xconfig.

Check your kernel version using the following command

uname -r

Download source using the following command

#apt-get install linux-source-2.6.26

Make directory for compiling

#mkdir ~/newkernel/

Copy source to newly created folder

#cp /usr/src/linux-source-2.6.26.tar.bz2 ~/newkernel/

#cd /newkernel/

Extract the source using the following command

#tar xjf linux-source-2.6.26.tar.bz2

#cd linux-source-2.6.26

Optional Step

You might optionally want to copy a working template for the kernel .config to this directory, you can find some in /boot/.

#cp /boot/config-$(uname -r) ./.config

Check your processor details using the following command

#cat /proc/cpuinfo

Configure kernel options

#make config

or

#make menuconfig

or

If you are using GNOME use the following command

#make gconfig

If you are using gconfig you should see similar to the following screen

screenshotlinuxkernelv2

In the above scree you have to click on the Y/M/N letter in the very last column of your choice to enable or disable some options

Now Clean the slate for kernel compiling

#make-kpkg clean

If you have a multiprocessor machine, you’ll want to make all processors work

#export CONCURRENCY_LEVEL=2

Perform the actual compile, this will take anywhere from 10 minutes to 5 hours depending on your hardware and configuration choices (the more you selected, the longer it will take). You need to include kernel_headers if you want to compile some other modules against your kernel, e.g. ati or nvidia drivers

.

#make-kpkg -- rootcmd fakeroot -- initrd -- revision=custom.001 kernel_image kernel_headers

It then will give you all kind of chatter, warnings and notices during, it’s quite normal.

Random Posts

Howto remove NSM Configuration from a Juniper Firewall Howto use downloaded ISOs as a repository in Debian

6 Responses to “Step by Step tutorial howto compile kernel in Debian 5.0 (Lenny)”

  1. Rich Hartley says:

    great info, but where do we get gconfig or xconfig because it’s not in the repos.

  2. anon debianite says:

    @Rich Hartley: They’re not separate programs but features of make.

  3. pflamellas says:

    well I follow this howto and give a error:
    make[1]: Entrando no diretório `/usr/src/linux-2.6.31.6/Documentation/lguest’
    cc -m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include -U_FORTIFY_SOURCE lguest.c -o lguest
    lguest.c:21:25: error: sys/eventfd.h: Arquivo ou diretório não encontrado
    lguest.c: In function ‘create_thread’:
    lguest.c:1021: warning: implicit declaration of function ‘eventfd’
    make[1]: ** [lguest] Erro 1
    make[1]: Saindo do diretório `/usr/src/linux-2.6.31.6/Documentation/lguest’
    make: ** [debian/stamp/build/kernel] Erro 2

  4. Harry Andersen says:

    make[1]: Leaving directory `/home/roy/newkernel/linux-source-2.6.26′
    /usr/bin/make ARCH=i386 /
    -C Documentation/lguest
    make[1]: Entering directory `/home/roy/newkernel/linux-source-2.6.26/Documentation/lguest’
    cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include lguest.c -lz -o lguest
    lguest.c:34:18: error: zlib.h: No such file or directory
    make[1]: *** [lguest] Error 1
    make[1]: Leaving directory `/home/roy/newkernel/linux-source-2.6.26/Documentation/lguest’
    make: *** [debian/stamp/build/kernel] Error 2

  5. zgfrd says:

    where:
    ….”error: zlib.h: No such file or directory”….

    install zlib1g-dev package and make-kpkg again

    regards,
    zgfrd

  6. Zsolt says:

    the lguest sys/eventfd.h problem solved when I turned off

    “Processor type and features”:
    “Paravirtualized guest support” = N

    lenny still have older libc6 which omits sys/eventfd.h

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值