Archive

Posts Tagged ‘Slackware’

Installing Kernel 2.6.x on Slackware

July 28th, 2009

Introduction

We know that every operating system has a core, which called kernel. Kernel is a vital component in operating system design, since it is the core and it has a lot of function, such as managing input/output, filesystem, loading modules for additional hardware, and many other functions. Well developped kernel will make the system stable and less vulnerable. This is what happened in GNU/Linux kernel development lead by Linus Torvalds (main kernel) and Chris Wright along with Greg Kroah Hartman (-stable team). They maintain the kernel development process in order to make GNU/Linux sistem operating works better, faster, modern, and also up to date. Up until now, there are two major version in kernel development, 2.4.x and 2.6.x. The stable and development scheme is no longer used. Everything that comes up marked as final version is considered stable version.

Usually, if you have installed a distro (combination of kernel with a lot of collection of utilities and application) like Fedora Core, Mandriva, SuSE, Debian, they have included the kernel, but as the kernel development move on, sometimes you have to upgrade your kernel to the latest version, in order to get new facility, new hardware support, and also bug fix on the previous kernel. The process can be easy or difficult, depends on your skill and also the package you are using. If you use your distro’s package (RPM, DEB, and TGZ), the process will be lot easier, since it has been prepared by the developer team and the only thing you have to do is install it and configure your boot loader configuration files. Meanwhile, if you tried to install from the original kernel source (called Vanilla), you have to learn few new things first. The process itself cannot be guarranted as 100% safe, so it’s not for newbie or production machines, but in this article i will try to give some small tutorial on how to compile the kernel from source based on my experience with some help from some friends of mine. In this article, i will use Slackware as the main distro.

Preparations

Slackware 12.1 by default comes with 2.6.24.5 kernel. Right now, it doesn’t have newer packages for kernel, but when Slackware-Current development has been started, there will be new kernel packages coming up and if you need for more features from the kernel, then it’s time to upgrade your kernel. Please note that if your system is running OK, then it’s not necessary to upgrade. Well, in case you have a plan to update, first you must download the kernel packages from /a, /d, and /k directory.

There are several packages which you should download, but here are the basic rule. Slackware include two kinds of kernel version, which are kernel with SMP (Symetric Multi Processors) support and the other one is without the SMP support. You will notice the smp in the kernel package which states that it supports SMP. Besides the SMP support, Slackware also come up with generic kernel and huge kernel. The generic kernel is modular kernel where all the modules were packaged separately in kernel-modules package, meanwhile the huge kernel is a bloated kernel with all the modules are build statically on the kernel itself. The huge kernel is the default kernel being used in the installation process, as it will detect most hardware during installation setup.

Most people (including me) like the idea of generic kernel, as the module gets loaded only when needed by the operating system. If you are planning to use generic kernel, you will have to download kernel-generic, kernel-modules, and kernel-headers package (kernel-source is optional, even though you might want to download it also if you are planning to compile driver that will be build as kernel modules, like NVIdia or ATI drivers). If you are planning to use the huge kernel, you only need to download the kernel-huge and kernel-headers (again, kernel-source is optional, but recommended).

Next, you should backup all of your /etc/ files in order something bad happened (assuming the worst case). One of the most important files is /etc/lilo.conf. It contains your current boot loader configuration files. When you have back up all your essential files, make sure you have install mkinitrd package in order to make the initial ramdisk for the 2.6 kernel (this is required when you choose to use generic kernel). When you are ready, let’s start the process.

Installation

Please note that it’s better to do an installation process rather than upgrade, since upgrade will remove the previous kernel and change it with the new kernel. If the kernel works perfectly, then you’re safe, but if you missed some mandatory steps, then you will ended up with the uncommon kernel panic message when you try to boot your new kernel. When you have installed the new kernel and make sure everything works perfectly, you can remove the older kernel if you like to save some spaces in your harddisk. Slackware comes with pkgtool package that can be used to install, remove, or upgrade packages smartly. I love using it. To install the new packages (this article assumes that you are using the generic kernel), type this on the konsole or terminal as root:
# installpkg kernel*
It will install all kernel packages (kernel-generic, kernel-modules, kernel-headers, kernel-source). After it finishes, we have to make an initrd. The reason to use an initrd is because you need to load kernel modules before mounting the root partition. Usually these modules are required to support the filesystem used by the root partition (ext3, reiserfs, xfs), or perhaps the controller that the hard drive is attached to (SCSI, RAID, etc). Essentially, there are so many different options available in modern Linux kernels that it isn’t practical to try to ship many different kernels to try to cover everyone’s needs. It’s a lot more flexible to ship a generic kernel and a set of kernel modules for it. The generic 2.6 kernel in Slackware only supports the ext2 filesystem (which is used by the initrd), and also supports most IDE controllers. So, if you have an IDE based system that uses the ext2 filesystem, then you will not need to use an initrd to boot. I used ext3 as my filesystem, so i should use initrd to boot to my root filesystem.

We will start making an initrd by using mkinitrd. Change to /boot directory. As i use ext3 filesystem, i should build an initrd image using Linux 2.6.26.2 kernel modules for a system with an ext3 root partition on /dev/hdc9. Note that you need both the jbd and ext3 modules to use ext3. Type :
# mkinitrd -c -k 2.6.26.2 -m ext3 -f ext3 -r /dev/hdc9
It will make a new file /boot/initrd.gz and also a directory called initrd-tree. Now that you’ve got an initrd (/boot/initrd.gz), you’ll want to load it along with the kernel at boot time. If you use LILO for your boot loader you’ll need to edit /etc/lilo.conf and add a line to load the initrd. Don’t forget to run /sbin/lilo -v after changing the contents to make the changes permanent. Here’s my lilo.conf :

# Linux bootable partition config begins
image = /boot/vmlinuz
  initrd = /boot/initrd.gz
  root = /dev/hdc9
  label = Linux-2.6.26.2
  read-only
# Linux bootable partition config ends
README.initrd -> /usr/doc/mkinitrd-1.3.2/README.initrd
System.map -> System.map-generic-2.6.26.2
System.map-generic-2.6.26.2
boot.1600
boot_message.txt
config -> config-generic-2.6.26.2
config-generic-2.6.26.2
diag1.img
initrd-tree/
initrd.gz
map
vmlinuz -> vmlinuz-generic-2.6.26.2
vmlinuz-generic-2.6.26.2

Conclusion

Updating kernel is not a hard process if you use your distro’s package and you are reading the manuals or documentation included by the developer. I would like to give my big thanks to Patrick J. Volkerding who has made great distro, wonderfull documentation, and also his support that helped me to install this 2.6.x kernel on my laptop. Slackware rocks!!

Source: ( http://www.informatix.or.id/willy/installing-kernel-on-slackware.php )

BLOG.em2u.WEB.ID Linux , ,