1. get required packages
  2. get the kernel
  3. configure kernel
    1. General setup --->
    2. Processor type and features --->
    3. Power management options (ACPI, APM) --->
    4. Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->
    5. Device Drivers --->
    6. File systems --->
  4. build kernel
  5. install kernel
  6. install initrd (optional)

kernel 2.6.6

get required packages

# apt-get install udev module-init-tools libncurses-dev gcc make

udev runs a daemon which will let you do hotswappable devices (if used). module-init-tools is needed to load modules (if used). the others are needed to make the kernel.

get the kernel

You can find the latest kernels at kernel.org, or use the debian package 'kernel-source-xxx'

If you use the debian package, then some patches are alreay applied and the configuration is that of the stock debian kernels. This can be handy if you want to just want to minorly tweak the stock kernel. The stock kernel uses modules heavily, and if used you should also use initrd.

configure kernel

# make menuconfig

general things to remember:

  • by default, a TON of stuff is compiled as a module, including some very core things like ext3 and ide/scsi support. You must build these basic things statically, or use a initrd ram disk.
  • "cat /proc/cpuinfo" will give you the processor type.

General setup --->

  • on: Kernel .config support

Processor type and features --->

  • Processor family
  • on: Symmetric multi-processing support
  • on: High Memory Support (4GB)

Power management options (ACPI, APM) --->

  • off: Power Management support

Bus options (PCI, PCMCIA, EISA, MCA, ISA) --->

  • off: ISA support
  • off: PCMCIA/CardBus support
  • off: MCA support
  • off: NatSemi SCx200 support

Device Drivers --->

  • on: make sure you have built in driver support for whatever disk the system is on. either under "SCSI device support" or "ATA/ATAPI/MFM/RLL support"
  • off: Multimedia devices --->
  • off: Graphics support --->
  • off: Sound --->
  • off: USB support

File systems --->

  • Pseudo filesystems --->
    • off: /dev file system support (OBSOLETE)
      this is /devfs, which we don't want.

build kernel

> make
> make modules
# make modules_install

install kernel

# cp arch/i386/boot/bzImage /boot/vmlinuz-KERNEL_VERSION
# cp System.map /boot/System.map-KERNEL_VERSION
# ln -s /boot/System.map-KERNEL_VERSION /boot/System.map
# update-grub

install initrd (optional)

Initrd can be useful if using the kernel source package, because everything will be set up as modules. If something vital, like software raid or scsi driver, is a module then you need initrd so that modules can be loaded before there is a filesystem.

# mkinitrd -o /boot/initrd-KERNEL_VERSION KERNEL_VERSION
# update-grub

If there is an initrd file in /boot matching a vmlinuz file, then update-grub should create the correct stanza. Here is an example:

title           Debian GNU/Linux, kernel 2.6.8-1-386
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.8-1-386 root=/dev/md0 ro
initrd          /boot/initrd.img-2.6.8-1-386
savedefault
boot