Building the Kernel
The next build step is to set up all the dependencies:
[root@heinz linux-2.4.20-8]# make dep
After the dependencies are handled, you're ready to build your kernel. The preferred format for kernels is bzImage, although the older vmlinuz/vmlinux format is still supported in 2.4 and 2.6 series kernels. To create a bzImage kernel, issue the following command:
[root@heinz linux-2.4.20-8]# make bzImage
Quite a bit of text will scroll by as the kernel compiles. If the compile is successful, a bzImage file is created in the arch/architecture/boot directory, where architecture is the processor type (typically i386 for Intel or AMD-based PCs). If something goes wrong with your compile, scroll back through the output for clues to the problem. Unless you're a programmer, some creative Google searching is usually the best way to find a solution. If you're having problems, there's an excellent chance that someone else has encountered the same problem. Identifying the file where the error happened can also help to isolate the issue.
After you've created a bzImage, you need to compile the modules required to support the kernel. Issue this command:
[root@heinz linux-2.4.20-8]# make modules
Another compile will ensue. If there are errors, use the same approach as with the kernel. Once the modules have compiled successfully, you'll need to move them into place:
[root@heinz linux-2.4.20-8]# make modules_install
This will copy all the modules into /lib/modules/kernelname.
Next, you need to move the bzImage to your boot directory:
[root@heinz linux-2.4.20-8]# cp arch/i386/boot/bzImage /boot/bzimage.2.4.20-oct-03
Be sure to give the bzImage file a unique name so you can identify it easily, and to avoid overwriting any other kernel images you have installed.
Finally, you need to add an entry to your bootloader. Typically, this will be either LILO or Grub. For LILO, add an entry like the following to lilo.conf:
image=/boot/bzImage.2.4.20-oct-03 label=2.4.20-October-2003 root=/dev/hda1 read-only
After adding the entry, run the following commands to update LILO:
[root@heinz linux-2.4.20-8]# lilo [root@heinz linux-2.4.20-8]# lilo -q
If you use Grub, add the following to grub.conf:
title October 20003 (2.4.20-8) root (hd0,0) kernel /bzImage.2.4.20-oct-03 ro root=/dev/hda1
When the bootloader is configured, you're ready to boot the new kernel. Both your existing kernel and the new one should be listed as boot options. Choose your new custom kernel, and watch closely. Now is when you'll find out if any issues need to be resolved. If you run into problems, you can always boot your old kernel, fix the issue, and boot the new kernel again. If you need to rebuild the kernel again, be sure to run make mrproper in your source directory. You can then copy the .config file back in to speed configuration.