Tuesday, March 3, 2009

Kernel headers installation

In order to install any core software like device drivers and the like on linux systems you need to install the kernel headers first. By default the kernel headers are not installed. The Linux operating system that you generally run is the kernel in a binary format alongwith the standard device drivers and other general software that is part of any operating system.
  1. To check for kernel headers type the following in your linux system :
        $ls -l /lib/modules/`uname -r`/build/
    If the output of the above code gives you the .config file as well as the include directories then you already have the kernel headers installed and you can happily skip the rest of this post.

  2. If you can connect the computer on which you want to install the kernel headers to the internet then you can use the package management facility of your linux distro. The catch is that each distro has its own way of managing the packages and you may not get the same solution on your distro.
    • If your distro happens to be ubuntu or debian then all you have to do is open a terminal and type
          $sudo apt-get install build-essential
      Now repeat step 1) and you should be done.

    • For other distros, I suggest that you open the home page of your distro and search for a similar solution, namely that of finding a package that contains the kernel headers and install them. If you cannot find some thing like this then proceed to step 3.
  3. Type into the terminal :
         $uname -r
    It will give the version number of the kernel that you are using. Download the rpm kernel-source-<your version>.<your comp arch>.src.rpm from here. Install it using the following command,
        $rpm --ivh kernel-source-<your version>.<your comp arch>.src.rpm
    P.S. :- if you do not have rpm installed in your system then u must install it.


Post a Comment