Sometime before the advent of the 2.0 kernel the old method of building the kernel was abandoned. What was removed was the requirement that the kernel source reside in a particular location in the file system. Every time you installed a new kernel source it was necessary to remove and rebuild several links that pointed gcc and others to the proper header files and assembly routines needed to compile other programs as well as the kernel. At about the time that this practice ended, Debian began to distribute Kernel Headers that were stable and always found at these ``predefined'' locations. Thus satisfying the general need to compile programs with kernel header information. Since the new kernel Make files are now aware of the location of the kernel source tree (by doing a pwd early in the make process) that tree can be located anywhere.
Debian follows the standard on file system layout very closely, so you can be assured that anything that you install in /usr/local will remain undamaged by any actions of the Debian Package System. The following procedure will allow the installation of kernel source; the compilation of that kernel source into an image and modules; and the installation of that image and those modules in the current system. Because the very few packages that depend on a particular kernel must interrogate the system to determine the running kernel, the registration with the packaging system of any given kernel is completely unnecessary.
The steps above will create a kernel source tree in /usr/local/source. This can, of course be any other place in the file system that seems appropriate, and need not be /usr/local/source. This is only one of several safe places you could put this tree. Creating the target directory and the link to it from the linux directory allows for future kernel source trees to also install here. Setting up the link to the target before untarring the source files makes everything end up where it should, rather than having to rename directories after the fact. The need for all of this stems from the fact that the source tar.gz file unpacks itself into the local directory named ``linux''. This can also cause problems if there is already a full directory named linux. With the link, there is at least the chance of moving the link to a fresh directory before unpacking new kernel source over the old.
If there are no patches to be applied to the source you are ready to build a kernel. Begin by changing to the directory /usr/local/source/linux. What gets done next depends on the state of the source tree and the desires of the builder. If the desire is that the build process should start from the ``pristine'' source, sometimes referred to as ``distribution clean'' then the first step is to execute make mrproper. From here the following steps are standard:
Configure the features of the kernel via:
make config
or
make menuconfig
or
make xconfig then:
make dep
make clean
make zImage
or if the image is larger than 1MB
make bzImage
then:
make modules
make modules_install
The major caution during the configure phase is: Make sure that devices needed by the kernel, before the root file system is mounted, are always built-in and never made as modules. Any other features declared to be modularized in the configure menu can be built as modules. Once the configuration phase is complete, the rest of the steps should proceed with no errors. Use of make zImage will result in the kernel image being placed in arch/i386/boot/zImage. The normal place for this image is in /boot/vmlinuz<version>, where it can be accessed using the link from /vmlinuz. The kernel image must be moved to /boot ``by hand'' and the new link created in /vmlinuz. The system map file, System.map, found in /usr/local/source/linux should also be placed into /boot with the version number appended. Refreshing the link in /System.map to point to this new file will complete the setup. If you use LILO for loading the kernel there are several steps necessary for safe installation of the new kernel.
Simply copying the new kernel over the old, will not result in the desired effect. Copying the old kernel to a separate location and copying the new kernel into the old slot also doesn't quite get the desired result, even though this is the correct first step.
Once the files have been moved, LILO still needs to be informed of
the changes. When lilo is run, it reads its configuration information
from the file
/etc/lilo.conf, so, to inform
LILO of the change
in kernels it is necessary to edit/create this file. If the file starts
out like:
# /etc/lilo.conf - - single Linux installation.
boot=/dev/hda1
root=/dev/hda1
compact
install=/boot/boot.b
map=/boot/map
vga=normal
delay=20
image=/vmlinux
root=/dev/hda1
label=Linux
read-only
then you need only add the following section:
image=/vmlinuz.old
root=/dev/hda1
label=Old
read-only
next, run lilo and the new kernel will be installed with access to the old kernel as a fall back.
Debian kernels are often built with all the SCSI low level drivers built in. This makes the uncompressed kernel greater than 1 Meg, requiring the use of bzImage instead of zImage. bzImages can sometimes cause problems for some hardware and for some loaders. loadlin has been known to have problems with these kernel images in the past, although most of those difficulties have already been fixed.
If loadlin is used as the boot loader, then none of the above actions will make the new kernel available. You must copy the zImage file to the file that is used on the DOS partition as the kernel image file. If you use loadlin to boot the file linux from your DOS partition, then you must copy the new kernel image into the file linux on the DOS partition. Also make sure that make modules_install has been run, and you are ready to reboot the new kernel.
If you boot from a floppy, then mount the floppy as a DOS disk, and copy the kernel image file from /arc/i386/boot/zImage to the file linux on the floppy. This is the kernel image file on the boot floppy and replacing it with the new kernel image will allow the system to boot under the new kernel.