Install Kernel Building Tools and Kernel Source

At this point we've got a stable, functional, usable system. The next thing we want to do is create a kernel that's tailored to our system. To do this we're going to need to install the kernel source tree as well as some other packages, so let's get to it.

apt-get install bin86 binutils gcc libc6-dev ncurses3.4-dev
apt-get install make patch kernel-package

As part of the kernel-package configuration you'll be asked for your full name and email address. I suggest you fill them in.

apt-get install kernel-source-2.0.34

Compile Your First Custom Kernel

At this point it's time to build our first custom kernel. Why build a custom kernel? Well, it's tailored for your hardware. The stock debian kernel supports lots of drivers you don't need and is therefor quite a bit larger than you need it to be. It also may not support some features you'd like to have (sound and APM come immediately to mind) so you'll have to build a kernel to get those features.

And it's good for you. It's the unix way of doing things, compiling from source. It won't hurt at all, especially with the thoughtful kernel-package provided by debian.

The first step in kernel building is configuration. I suggest you use the nice curses-based, dialog box configuration tool menuconfig:

cd /usr/src/linux
make menuconfig

You'll see that the first time you make menuconfig that make will actually build the executable.

I will walk through the process I use to build the kernel for my desktop machine, to give you an idea of what's in store for you. You should, of course, configure for YOUR hardware and software needs, not mine.

When the Main Menu comes up, spend some time reading the instructions at the top. Important to understand is the fact the you can build a feature into your kernel (Y), exclude a feature from your kernel (N), or create a module that can be installed and removed from the kernel (M).

Note that some features are

Y/N only ([ ]),

and others are

Y/M/N (< >).

Decisions about how much of your kernel to modularize can become religious, so I'll just say that in my case, I've chosen to leave as modules those items that came as modules with the installation kernel.

The first selection is Code maturity level options, and I choose

[*] Prompt for development and/or incomplete code/drivers

Next is Loadable module support, and my choices are

[*] Enable loadable module support
[ ] Set version information on all symbols for modules
[*] Kernel daemon support (e.g. autoload of modules)

For General setup I select
(only selected items are shown from this point onward)

[*] Networking support
[*] PCI bios support
[*] System V IPC
<M> Kernel support for a.out binaries
<*> Kernel support for ELF binaries
<M> Kernel support for JAVA binaries
[*] Compile kernel as ELF - if your GCC is ELF-GCC
(Pentium) Processor type

For Floppy, IDE, and other block devices I select

<*> Normal floppy disk support
[*] Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
[*] Include IDE/ATAPI CDROM support
[*] Intel 82371 PIIX (Triton I/II) DMA support
<*> Loopback device support
<*> RAM disk support
[*] Initial RAM disk (initrd) support

My Networking options are

[*] TCP/IP networking
[*] IP: Drop source routed frames
[*] IP: Allow large windows (not recommended if <16Mb of memory)

I need SCSI support, so

<*> SCSI support
<*> SCSI disk support
<M> SCSI tape support
<M> SCSI CD-ROM support
[*] Verbose SCSI error reporting (kernel size +=12K)

And for SCSI low-level drivers I need

<*> BusLogic SCSI support

For Network device support I need quite a few things:

[*] Network device support
<M> Dummy net driver support
<M> PPP (point-to-point) support
<M> SLIP (serial line) support
[*] CSLIP compressed headers
[*] Keepalive and linefill
[*] Ethernet (10 or 100Mbit)
[*] Other ISA cards
<M> NE2000/NE1000 ISA support

I can skip both of the following:

ISDN subsystem
CD-ROM drivers (not for SCSI or IDE/ATAPI drives)

However, Filesystems will get lots of choices:

<*> Minix fs support
<*> Second extended fs support
<M> Native language support (Unicode, codepages)
<M> ISO9660 cdrom filesystem support
<M> DOS FAT fs support
<M> MSDOS fs support
<M> VFAT (Windows-95) fs support
<M> Codepage 437
<M> NLS ISO 8859-1
[*] /proc filesystem support

It's worth noting here that you must select Native Language Support to even see the ISO9660 and VFAT choices. I've selected Codepage 437 and NLS ISO 8859-1 because the vfat module seems to look for them when a vfat partition is mounted.

Next we select some Character devices.

<M> Standard/generic serial support
<M> Parallel printer support
[*] Mouse Support (not serial mice)
<M> PS/2 mouse (aka "auxiliary device") support

I make no selections in either Sound or Kernel hacking.

I return to the Main Menu and select Exit, and when I am asked

Do you wish to save your new kernel configuration?

I say Yes.

Now that configuration is complete, you need just two commands to build the new kernel:

make-kpkg clean
make-kpkg --rev Testbox.1.0 kernel_image

Depending on your hardware, building the kernel can take anywhere from several minutes (my current K6-200 with 32MB of RAM) to several hours (my first linux box, a 386SX-16 with 4MB), so go for a coffee or a day hike, as appropriate.

Install the Newly Compiled Kernel

Now that the compile is complete, kernel-package has thoughtfully packaged up the new kernel so you can install it with dpkg, and everything will go in exactly the right place.

dpkg -i /usr/src/kernel-image-2.0.34_Testbox.1.0_i386.deb

Once the new kernel is installed, you'll need to reboot to load it. After you reboot, you'll want to fix up your Custom Boot Floppy with the new kernel (just like we did before).


So, to continue the process, set up internet mail and usenet news.

Return to Our Man Pann's Linux Page.

Pacifier Online is my Internet Service Provider.

Hurricane Electric provides me with Web/Domain Hosting Services.

Last modified: 29-Apr-99 by Pann McCuaig.

Copyright 1999 by Pann McCuaig. All rights reserved.