[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ A ] [ next ]


Debian Reference
Chapter 7 - The Linux kernel under Debian


Debian has its own method of recompiling the kernel and related modules. See also Debian and the kernel, Section 2.7.


7.1 Kernel (re)compile

The use of gcc, binutils, and module-init-tools from Debian unstable may help when compiling the latest Linux kernel. See /usr/share/doc/kernel-package/README.gz, especially the bottom of this, for the official information.

Since it is a moving target, kernel compilation is a difficult subject that may confuse even the most admired developer:

Manoj Srivastava wrote:

--initrd requires a Debian-only cramfs patch.

Herbert Xu wrote:

No it does not, all you have to do to use a filesystem other than CRAMFS is to set MKIMAGE in /etc/mkinitrd/mkinitrd.conf.

Be careful and always rely on the /usr/share/doc/kernel-package/README.gz by Manoj and Kent and http://kernel-handbook.alioth.debian.org/. Make sure to obtain the latest unstable version of the kernel-package package if you are to compile the latest version of the kernel.

initrd is not needed for a kernel compiled only for one machine. I use it since I want my kernel to be almost the same as the one provided by the kernel-image packages. If you use initrd, make sure to read mkinitrd(8) and mkinitrd.conf(5).


7.1.1 Kernel headers

Most "normal" programs don't need kernel headers and in fact may break if you use them directly; instead they should be compiled against the headers with which glibc was built, which are the versions in /usr/include/linux and /usr/include/asm of the Debian system.

So do not put symlinks to the directories in /usr/src/linux from /usr/include/linux and /usr/include/asm, as suggested by some outdated documents.

If you need particular kernel headers for some kernel-specific application programs, alter the makefile(s) so that their include path points to dir-of-particular-kernel-headers/include/linux and dir-of-particular-kernel-headers/include/asm.


7.2 Tuning the kernel through the proc filesystem

The behavior of the Linux kernel can be changed on the fly using the proc filesystem.

For basic information on changing kernel parameters through the /proc filesystem, read Documentation/sysctl/* in the Linux source.

See some examples of kernel parameter manipulations in /etc/init.d/networking and Strange access problems with some websites, Section 3.8.5.

See sysctl.conf(5) for how to set up the boot time kernel configuration through /proc filesystem with /etc/init.d/procps.sh script usually run from /etc/rcS.d/S30procps.sh.


7.2.1 Too many open files

The Linux kernel may complain "Too many open files". This is due to the small default value (8096) for file-max. To fix this problem, run the following command as root:

     # echo "65536"  > /proc/sys/fs/file-max  # for 2.2 and 2.4 kernel
     # echo "131072" > /proc/sys/fs/inode-max # for 2.2 kernel only

or put the following into /etc/sysctl.conf for the permanent change:

     file-max=65536   # for 2.2 and 2.4 kernel
     inode-max=131072 # for 2.2 kernel only

7.2.2 Disk flush intervals

You can change disk flush intervals through the proc filesystem. The following will shorten its interval from the default five seconds to one second.

     # echo "40 0 0 0 100 30000 60 0 0"  > /proc/sys/vm/bdflush

This may negatively impact file I/O performance a little bit. But this secures file contents except for the last one second which is shorter than the default five seconds. This is true even for journaling filesystems.


7.2.3 Sluggish old low memory machines

For some old low memory systems, it may still be useful to enable over-commit of memory through the proc filesystem:

     # echo 1 > /proc/sys/vm/overcommit_memory

7.3 The 2.6 kernel with udev

The udev is a dynamic replacement for /dev/. Device names can be chosen to be very short ones. The devfs used in the 2.4 kernel is now obsolete.

Installing the new Debian 2.6 kernel provided by kernel-image-2.6.NN with udev package will enable this.


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ A ] [ next ]


Debian Reference

CVS, Thu Jan 18 11:52:15 UTC 2007

Osamu Aoki osamu#at#debian.org
Authors, Section A.1