This guide is to help you easily and safely compile a new linux kernel for your system. The distrobution of my choice is SuSE linux (9.2 at time of writing). First we'll go through the conceptual steps of the process, then actual commands used to complete the new kernel.

Conceptually Compiling a Kernel.

I don't know who created the names for the different sub-commands in make, but this is the easiest I can explain them. The number here will correspond to the command we will enter in the second section.

1. Remove the old un-needed files that were deprecated, revised, and/or felt out in the new kernel.

With any project or creation, we'd like a clean workarea and environment to create our new kernel.


2. Remove any old attempts, dependecies, core files, and other residual "fluff" created.

While this might seem redundant, the reasoning is that once the area has been cleaned, this step is more like organizing the workspace making it look mrproper.


3. Create a template of the current configuration and prompt for user input about the new features

We use the old config as the building template for the new kernel, this helps to ensure that all the necessary information about our kernel is included.


4. Edit and configuration in a menu to add or remove features.

Here is where some optimizing can take place. Menuconfig allows you to build in drivers into the kernel or load them as modules. I prefer to build them in to prevent a module from getting corrupt. You can also remove useless things such as: filesystems you won't use, protocols(IPv6), old architectures, etc.


5. Build the kernel.

Create a compressed image using bzip2. bzImage refers to the image of the kernel you are building and it will be compressed with bzip2 to my understanding.


6. Create any modules

Making modules simply create all the items that were marked as module in menuconfig.


7. Install those modules

modules_install takes you newly created modules and installs them to you system, like putting all the pieces of the puzzle together.


8. Create the ram disk image

The ramdisk is what the bootloader uses while loading your system. Essential driver and configurations are stored here until the kernel can boot and take control.


make clean		(removes un-needed files)
make mrproper		(removes old attempts, depedencies, core files)
make oldconfig		(creates current configuration and prompts for new features in the newer kernel)
make menuconfig 	(add/remove features you feel are necessary or un-necessary. Save your new configuration)
make bzImage	 	(builds the kernel)
make modules 		(builds all the kernel modules)
make modules_install	(installs the modules)
mkinitrd -k vmlinux-VERSION -i initrd-VERSION