Pick a Free OS

Kernel Compilation & Avoiding ‘Unresolved Symbol’

Kernel Compilation

Why a Kernel should be compiled?

By default kernel module version has to be disabled when developing new modules, but this is enabled by default in some older versions of popular distribution.

Apart from this there are many other reasons why a kernel has to be recompiled . I’m not listing all those reasons due to lack of space.

Following are the things to be taken into consideration before compilation.

Creating copy of complete kernel sources at different location other than /usr/src .

Taking backup of important user data is a good precautionary measure .

Prerequisite for kernel recompilation

Logging in as root.

Kernel sources directory has to be installed on the system ,this could be done by installing the kernel source rpm’s from the installation CD’s or downloading latest kernels from kernel.org.

Important things to enable/disable in the ‘menuconfig’ dialog box.

Under Loadable module support

Enabling ‘Enable loadable module support’

Disabling ‘Set version information on all module symbols’

Under Processor type and features

Selecting the correct processor type

Enabling Symmetric multi-processing support (regardless of whether your system is single processor or multi processor one)

Under USB Support

Enabling USB support (If you intend to develop USB drivers)

Under Kernel Hacking

Enable Kernel Debugging.

Steps in Kernel Compilation

Untar or Install kernel source rpm’s.

Go through the ‘readme’ under kernel source directory.

bash#make menuconfig – Make the above changes and additionally any other changes you want.

bash#make depends - This for knowing about the file dependencies.

bash#make bzImage – This is for creating bootable kernel.

bash#make modules

bash#make modules_install - 6 & 7 commands for compiling the kernel modules if any.

After the above step bootable kernel image is found under /boot/arch/i386/boot/ directory with the file name ‘bzImage’

In order to make the BIOS find the above bootable image file any of the below 2 things can be done

Making the entry in bootloaders (lilo or grub)

If ‘Lilo’ is the bootloader then do the following

bash# man lilo

bash# man lilo.conf

In /etc/lilo.conf file add the following lines

image=/boot/bzImage


label=User_Defined_Kernel


root=/dev/hda1


read-only

After editing /etc/lilo.conf