Compiling new kernel on Slackware 12.2

I have visited http://www.kernel.org to check the latest version of the Linux kernel. At this writing, version 2.6.29.3 was the latest. So I have downloaded it from here. I wanted to install and test the new features of this kernel. Here are the steps I made to compile and use it.

1. Acquire root privilege
sudo su

2. Download the kernel sources
fetch http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.29.3.tar.bz2

3. copy the sources to /usr/src
cp ./linux-2.6.29.3.tar.bz2 /usr/src

4. extract the sources
cd /usr/src/; tar xvjf linux-2.6.29.3.tar.bz2

5. go inside the new linux kernel source directory
cd ./linux-2.6.29.3

6. Clean the directory
make clean

7. Make the configuration file or have an old one loaded
make menuconfig

8. If you want to load your old kernel’s config file, scroll at the buttom of the screen and choose Load an alternative Configuration File
and type the location of your old configuration file
/boot/config-huge-2.6.27.7

9. When the config is loaded, check other kernel settings you might want to change, and enable or disable a module by selecting it from the list. The configuration file you have just loaded works since it was the one included in your distro, so if you want new features then scroll and select it from the list.

10. After selecting the features you wanted to compile or added as a module, go to the exit at the buttom of the page, then click ok to exit the menuconfig.

11. Make the kernel
make

12. Install the kernel
make install

12. Make the kernel image
make bzImage

13. Make and install the modules
make modules && make modules_install

14. copy the new image to /boot
cp ./arch/i386/boot/bzImage /boot/vmlinuz-2.6.29.3-CUSTOM
and your config to /boot
cp .config /boot/config-2.6.29.3-CUSTOM

15. Create an initial ramdisk. (change the ext3 to whatever file system you use and the device file in which your root partition resides. In my case, my / is on device /dev/sda5)
mkinitrd -c -k vmlinuz-2.6.29.3-CUSTOM -m jbd:ext3 -f ext3 -r /dev/sda5

16. After the mkinitrd command, it will generate /boot/initrd.gz. If you want, you can change your initrd.gz name.
mv /boot/initrd.gz /boot/initd-2.6.29.3-CUSTOM.gz

17. Edit your /etc/lilo.conf and add new entries at the buttom. Don’t remove the old settings so you would have a fallback.
Add these lines. Change the root value to the device for your / partition. You can also change the label.
image = /boot/vmlinuz-2.6.29.3-CUSTOM
initrd = /boot/initrd-2.6.29.3-CUSTOM.gz
root = /dev/sda5
label = Linux-2.6.29.3
read-only

18. After saving your lilo.conf, install it.
lilo

19. Restart your computer
reboot

Then on the bootsplash screen, select your new kernel and If you're lucky, it will work!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s