Pick a Free OS

User login


Compiling the Linux kernel

'make bzImage' starts the kernel compile. This will take a while depending on your processing power and the options that you selected. Watch the case here though. It is 'bzImage' and not 'bzimage'. This will create a compressed kernel image. This reduces the size of the kernel and is a good move unless you want a bulky kernel. Just about all kernels these days are compressed. You do not have to make any special changes your configuration to support compressed kernels. The kernel will un-compress itself at boot.

You could also have put all the above commands in a single command-line as

make dep clean modules modules_install bzImage

You can stop the kernel and module compilation at any time in between by pressing Control-C. Then when you want to re-start the compile just run 'make modules' or 'make bzImage' again and the compile will start from the point where you canceled it. If you make some changes to the configuration at this point then you will need to run 'make dep' again and all compilation will start right from the beginning.

The newly compiled kernel will be in usr/src/linux/arch/i386/boot as bzImage. Here i386 should be replaced by the architecture that you're compiling for.

Time to check out the new kernel. You will need to make a new lilo entry for the new kernel. Do not simply replace your old kernel with the new


Edit /etc/lilo.conf and look for the entry that you use to boot into Linux. This will look something like

image = /vmlinuz

label = linux

root = /dev/hda1

Add another section to lilo.conf by copying this section below. Replace the 'image = /vmlinuz' line with the following.

'image = /usr/src/linux/arch/i386/boot/bzImage'

Also change the label to something like new

label = new

Leave the root entry as is.

Save the file and run /sbin/lilo to save the new settings.

Reboot your machine and at the lilo prompt enter 'new' to boot the new kernel. If the system boots properly then one half of your work is done. Now check out the various devices and see if you haven't missed out some important device driver. If everything checks out then you can go ahead and install the new kernel.

Go into /usr/src/linux and type 'make install'. This will install the new kernel as /vmlinuz and install the new system map. Once that is done you

can remove the new entry from lilo.conf. Your default Linux boot entry will get you into Linux with the new kernel.

Jim Bradley has this additional advice if you have SCSI devices and support has been compiled as a module.