Build your own Slackware kernel

Slackware provides many out of the box kernels optimized to be supporting a vast of various hardware configurations. Drawback is these kernels are not optimized for a specific hardware configuration or to be running on best performance. Enough reasons for a customized kernel.

The good news is, doing so is quite easy on Slackware, compared with other major Linux distributions. This article covers important steps building a customized kernel for a Slackware box

 

General conditions

 

Here is how it goes

Step 1:

Make yourself comfortable with the hardware configuration of your box. Look into /sys and /proc. Have a look on your vendors site and / or consult your mainboard manual. You should at least know:

 

Examine your PCI configuration:

 

lspci

 

Verify loaded modules

 

lsmod

 

Step 2:

Grab the 2.6.x kernel you want from www.kernel.org. Grab also the corresponding .sign file.

 

Step 3:

Verify the kernel file signature:

 

gpg --verifiy linux-2.6.23.16.tar.bz2 linux-2.6.23.16.tar.bz2.sign

 

Step 4:

Copy the linux kernel source file to /usr/src and extract it.

 

cp linux-2.6.23.16.tar.bz2 /usr/src
tar xvfj linux-2.6.23.16.tar.bz2

 

Step 5:

If you never have customized a kernel before, you must now go trough hundreds of kernel parameters. Nevertheless, it is worth the effort. Remember:

 

Start kernel configuration:

 

make menuconfig

 

Dont't be premature, these are the top level adjustments, there are hundreds of sub-options. If in doubt what to do, have a look onto your running kernel configuration (e.g. a standard Slackware kernel).

kernel

When finished, save configuration and exit. Type:

 

make bzImage && make modules && make modules_install

 

Step 6:

Copy the kernel and system map to the /boot folder.

 

cp arch/i386/boot/bzImage /boot/vmlinuz_2.6.23.16
cp System.map /boot/System.map_2.6.23.16

 

Modules already have been installed to /lib/modules

 

Step 7:

Create some symlinks.

In /usr/src type:

 

ln -s linux-2.6.23.16 linux

 

In /boot type:

 

ln -s System.map_2.6.23.16 System.map
ln -s vmlinuz_2.6.23.16 vmlinuz (optional)

 

Step 8:

Adjust your boot loader.

If you are a LILO user type "lilo"

if you are using GRUB adjust your /boot/grub/menu.lst file

 

Step 9:

Reboot!

If you utilize specific modules, e.g. a graphic driver or VMware workstation modules, you have to recompile them.

 

Step 10:

Delete unnecessary sources in:

 

Upgrade your customized kernel

This is much more easier than customize a kernel for the first time. We distinguish:

You can do both by downloading the new full release or by just applying the a patch.

 

Step 1:

Kernel patch upgrade:

If you start with a new full release, extract it and then copy the .config file from the old kernel source tree into the new one. Type:

 

make oldconfig

 

If you just apply the patch, you don't have to do this.


Minor release update:

Proceed like described above, but there is a difference. As a new kernel version introduces new options not known to the previous kernel and its .configure file, you must set up these options first. To do so, simply answer the questions the "make oldconfig" scripts is going to ask you. Answer them with yes (y), no (n) or (m) for module.

 

Step 2:

Build your new kernel and modules.

 

make bzImage && make modules && make modules_install

 

Then proceed as described above.