Kernel Compilie

Decompressing the sources


If you have downloaded kernel sources from kernel.org you want to decompress the file in /usr/src. This will create a new directory called linux. Remember, make sure there the /usr/src/linux directory does not already exist. If it does, and it is a directory, use the mv command to change the directories name. If /usr/src/linux is a symbolic link to the directory containing the kernel sources, you can just delete this file. If you leave the sybolic link, and decompress the kernel file, you will overwrite the symbolic link with the directory containing the kernel sources.

Copy the kernel source file to the /usr/src directory, you must be root to do this:

cp linux-#.#.##.???
#'s represents the kernel version and ? is the compression format.


tar.gz format

If the kernel sources you downloaded are in the tar gziped (tar.gz), simply execute the following:

tar xzvf linux-#.#.##tar.gz
Where #'s represent your kernel version. You can leave out the v parameter if you do not want a verbose decompression of the files.


tar.bz2 format

Kernel sources compressed using the block-sorting file compression utility version 1.0 or later, require you to use the bunzip2 program:

bunzip2 linux-#.#.##.tar.bz2
tar xvf linux-#.#.##.tar
Where #'s represent your kernel version. Again, you can leave out the v parameter if you do not want a verbose decompression of the files.


It is not a requirement to decompress the kernel sources in /usr/src. You can decompress the kernel sources in any directory, compile the kernel, and make and install the modules. But afterwards, you should move the sources to /usr/src since some programs that require the kernel sources or headers will expect the sources to be in /usr/src. This also holds for programs you may want to compile. If for some reason you want to put the kernel sources in another location, then you should at least make a link from /usr/src/linux to where ever you put the sources:
ln -s locationofkernelsources /usr/src/linux

<- Back (Need)    TOC    Next (Patches) ->