Good programming practices

How to compile kernel 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 or use the direct link to linux-
Move it to /usr/src/ and unpack.

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

For convenience you can update link to the current linux sources.
  1. rm -rf linux
  2. ln -s /usr/src/linux- /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.
  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- rc.modules-
  4. ln -s /etc/rc.d/rc.modules- /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. ln -s /boot/vmlinuz- /boot/vmlinuz
  3. mv /boot/ /boot/
  4. ln -s /boot/ /boot/
  5. cp /usr/src/linux/.config /boot/config-
  6. ln -s /boot/config- /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- not /boot/vmlinuz.
  1. #new kernel
  2. image = /boot/vmlinuz-
  3. root = /dev/sda5
  4. label = Lx-
  5. read-only
  6. #old kernel
  7. image = /boot/vmlinuz-general-
  8. root = /dev/root
  9. label = Lx-
  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

You must be logged in to post a comment.