Good programming practices

How to compile kernel 2.6.39.3 in Slackware 13.1

July 13th, 2011

Just few days ago new stable linux kernel was released. In Slackware you can use it without patching. Here I describe how to compile and install kernel in easy way. Download the kernel source from kernel.org or use the direct link to linux-2.6.39.3.tar.bz2.
Move it to /usr/src/ and unpack.

  1. mv linux-2.6.39.3.tar.bz2 /usr/src/
  2. cd /usr/src/
  3. tar xvfj linux-2.6.39.3.tar.bz2

For convenience you can update link to the current linux sources.
  1. rm -rf linux
  2. ln -s /usr/src/linux-2.6.39.3 /usr/src/linux

Go to the source directory and copy current kernel configuration.
  1. cd /usr/src/linux
  2. zcat /proc/config.gz > .config

Now you can update the old configuration by answering to questions about new options:

or just disable all new features.
  1. make oldnoconfig

If you want, you can now change any option of the configuration.
  1. make menuconfig

Make all you need. If you have multicore processor, use option -j, in this example I had quadcore.
Make   
  1. make -j5 all

Install modules
  1. make modules_install

then kernel to /boot directory
  1. make install

Copy current list of modules and link the new file.
  1. cd /etc/rc.d
  2. rm rc.modules
  3. cp rc.modules-2.6.37.6 rc.modules-2.6.39.6
  4. ln -s /etc/rc.d/rc.modules-2.6.39.6 /etc/rc.d/rc.modules

It is good idea that you should leave aslo old kernel in the boot options in case if new kernel would fail.
Rename new kernel files and add them version number.
  1. mv /boot/vmlinuz /boot/vmlinuz-2.6.39.3
  2. ln -s /boot/vmlinuz-2.6.39.3 /boot/vmlinuz
  3. mv /boot/System.map /boot/System.map-2.6.39.3
  4. ln -s /boot/System.map-2.6.39.3 /boot/System.map
  5. cp /usr/src/linux/.config /boot/config-2.6.39.3
  6. ln -s /boot/config-2.6.39.3 /boot/config

Now edit lilo configuration /etc/lilo.conf. Remember that /boot/vmlinuz now point to new kernel, so you should see if image = of prevoius item points to i.e. /boot/vmlinuz-general-2.6.38.7 not /boot/vmlinuz.
  1. #new kernel
  2. image = /boot/vmlinuz-2.6.39.3
  3. root = /dev/sda5
  4. label = Lx-2.6.39.3
  5. read-only
  6. #old kernel
  7. image = /boot/vmlinuz-general-2.6.38.7
  8. root = /dev/root
  9. label = Lx-2.6.38.7
  10. read-only

At the end use lilo command to update the boot menu.
  1. lilo

After restart you can enjoy new kernel :). Hope this will work for you.

Leave a Response