Kernel Customization

From Caos Linux Wiki

Jump to: navigation, search

NOTE: The procedures described in this document are executed in bash

The reason to make a custom kernel may vary from person to person; the writer's reason is that the very last bit of performance should be squeezed out of a machine. Thus, the kernel should be modified to match your workstation's specific hardware configuration. But it is always a risk that something may go wrong during a kernel recompilation so it will be up to you to decide if you are prepared to take the risk or not. Nevertheless, this document describes the steps necessary to build a customized cAos kernel.

Contents

[edit] Install the Development Packages

First of all the cAos development packages have to be installed:

yum groupinstall devel

[edit] Backup the Current Kernel

Backup existing kernel files using the following commands:

cd /boot
mkdir kernels
cp System.map-2.6.11.6-61.caos.smp kernels/
cp config-2.6.11.6-61.caos.smp kernels/
cp initrd-2.6.11.6-61.caos.smp.img kernels/
cp vmlinuz-2.6.11.6-61.caos.smp kernels/
cd /lib/modules/
cp -R 2.6.11.6-61.caos.smp/ /boot/kernels/

[edit] Obtain the Kernel Source Package

Install the cAos kernel source by executing:

yum install linux-source

Create linux as a symbolic link to the actual kernel directory:

cd /usr/src/
rm linux
ln -s  linux-2.6.11.6-61.caos linux
cd linux
make clean

Copy the config file you want to customize:

cp /boot/config-2.6.11.6-61.caos.smp .config

[edit] Configure the Kernel

You are now ready to customize the kernel according to your needs. Give following commands:

cd /usr/src/linux/
make menuconfig

You will now enter the Linux kernel menu configuration. Add and remove options as needed, bearing in mind that:

  • Compiled options gives a faster kernel compared with module options
  • Module options gives a smaller kernel compared with compiled options

When all changes have been made and double-checked for accuracy, it's time to build the kernel. Keep choosing Exit until the system prompts you to save the kernel configuration. Choose Yes and press ENTER.

[edit] Build the Kernel

Compilation of the kernel is the most critical stage in the procedure. But if you have followed these instructions, you should make it through. Give the following commands:

make && make bzImage && make modules && make modules_install

The compilation time depends on your system's performance. The more modules you have in your kernel, the longer the compilation time will be. When the process is complete, simply install your new kernel and save its .config file:

make install
cp .config /boot/config-2.6.11-61.caoscustom
sync
sync

NOTE: The custom kernel's name is 'caoscustom' and the command 'make install' will also update the file /etc/grub.conf

[edit] Test the New Kernel

Your custom kernel is now ready for testing and evaluation. Use the shutdown or reboot command to restart your system with the new kernel.

Personal tools