Linux Headquarters

I've installed Linux… now what???

Finding and Installing Kernel Source Code

Introduction

Usually, the Linux kernel source code is installed with the operating system. If for some reason the kernel source is not installed, you will have to download and install them. Or perhaps you already have older kernel source installed but wish to upgrade to an entirely new kernel. In either case, you will need to download and install the source code for the kernel. Kernel sources can be found at the following sites:

www.kernelnotes.org kernel source archive
ftp.kernel.org FTP site

Kernel source code is usually distributed in tar format that has been compressed in bz2 or gz format. For example, downloadable kernel source files look something like linux-2.2.16.tar.gz or linux-2.2.16.tar.bz2. If you are not familiar with .gz and .bz2 file formats, see the gzip and gunzip: Files With .gz Extensions guide and the bzip2 and bunzip: Files With .bz2 Extensions guide.

 

Installing the Source Code

By convention, the /usr/src/linux directory is a symbolic link to the directory that actually contains the kernel sources. For example, if you are using Red Hat 6.2, the kernel sources are placed in /usr/src/linux-2.2.14. Going to the /usr/src/linux will redirect you to the /usr/src/linux-2.2.14 directory. However, if you have never had any kernel sources installed, it’s likely that you won’t see any files or directories named linux.
For the purpose of this guide, we will use linux-2.2.x for the kernel name. You should replace the x with the version number you are installing.

  1. Place the kernel file you downloaded in the /usr/src directory. You must be root to do this.
  2. If you downloaded the kernel in bz2 format, execute the following command:
    bunzip2 linux-2.2.x.tar.bz2 

    If you downloaded the kernel in gzip format, execute the following command:
    gunzip linux-2.2.x.tar.gz

    You should now have a file named linux-2.2.x.tar

  3. Before you extract the tar file, you should be aware that the kernel will install itself in the linux directory. If you have source code from older kernels installed, the problem here is that the linux “directory” probably isn’t a directory at all. It is a symbolic link to another directory containing the older kernel source. In this case, you must remove the symbolic link with the following command:
    rm linux
  4. tar -xvf linux-2.2.x.tar – Unarchive the tar file
  5. mv linux linux-2.2.x – Rename the linux dir to linux-2.2.x
  6. ln -s linux-2.2.x linux – Create a symbolic link from linux to linux-2.2.x

The kernel source code is now installed. To make sure everything was successful, issue the following command:

ls -al

For example, if you installed the 2.2.16 kernel source, you should see something similar to this:

drwxr-xr-x 5 root root 4096 Jul 29 12:59 .
drwxr-xr-x 22 root root 4096 Aug 2 1998 ..
lrwxrwxrwx 1 root root 12 Jul 29 12:59 linux -> linux-2.2.16
drwxr-xr-x 14 1026 101 4096 Jun 7 17:26 linux-2.2.16
-rwxr-xr-x 1 bfox bfox 74557440 Jul 29 12:43 linux-2.2.16.tar

You can now remove the tar file if you wish with the following command:

rm linux-2.2.x.tar

Now go to the Configuring a New Kernel guide.

What is Related

Comments are closed.

Subscribe to email feed

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Dedicated Linux Serv

Linux is the popular system nowadays, offering all the benefits ...

StarOffice 5.1

Introduction StarOffice 5.1 is a complete office suite with a word ...

AxY FTP

Introduction AxY FTP, formerly known as wxFTP, is a graphical FTP ...

Adobe Acrobat PDF Re

Introduction Many of you are probably familar with Adobe Acrobat Reader ...

Macromedia Shockwave

Introduction Macromedia has developed a version of its popular Shockwave plugin ...

Twitter updates

No public Twitter messages.