Linux Index

Compiling the kernel


Introduction

After installation, you have a default kernel with default modules. Modules can be seen as drivers which can are dynamically loaded when they are needed. Thanks to modules, the default installation is more flexible : more drivers may be included even if they are not used.

Unfortunately, they are still many case where you will have to recompile the kernel and the modules. For example, till now, if you plan to use an ATAPI CD writer, you will probably have to recompile : the CD writer software support only SCSI writers, so you have to enable the SCSI emulation.

The compilation

You will find the sources under /usr/src/linux. In this directory, the file README contains documentation. If needed, you can also have a look in the directory /usr/src/linux/Documentation if it exists.

If you are already in graphical mode (XWindows), the shortest way to get started is to do the following as root user :

cd /usr/src/linux
make mrproper
make xconfig
make dep ; make clean
make zImage
mv /usr/src/linux/arch/i386/boot/zImage /boot/myImage
make modules
mv /lib/modules/2.2.12-20 /lib/modules/2.2.12-20-bak
make modules_install

The name /lib/modules/2.2.12-20-bak is here for the example.

After this, you have to edit the file /etc/lilo.conf to include a new entry for the /boot/myImage. This entry must be to first to act as default. Keep the old kernel as backup solution if something is going wrong. Now, you have only to type
lilo

This validate the changes you have made to /etc/lilo.conf. You can then reboot and try ... If you don't know how to reboot, type
/sbin/reboot

ATAPI CD Writers

If you have an ATAPI CD writer and if you plan to use cdrecord, you will have to enable the SCSI emulation. While configuring with 'make xconfig', do the following :

  • In 'Block devices', check 'n' for 'IDE/ATAPI CD-ROM support' and check 'y' for 'SCSI emulation support'.
  • In 'SCSI support', check 'y' for 'SCSI support' and 'SCSI CD-ROM support'. Check 'm' for 'SCSI generic support'

Sound-cards

For sound-cards support, it is highly recommended to load the driver as modules. So in 'Sound', check 'm' for 'Sound card support' and for the specific card you want to use.