Kernel Compile

What do I need?


Requirements

You need the following, minimum, to compile the kernel:
  1. A working Linux system
  2. GNU gcc (Kernel.org or distro disc)
  3. Bash shell
Additionally, you should consult the Changes file under the Documentation directory in the kernel sources for the minimum version of these and other software packages that are required for the kernel. If you are using a current distrobution (no more than two years old) you will probably have the necessary software and software versions already installed.

If you are using RedHat 7.0, you will also need the kernel compilier version of gcc: kgcc. The kgcc-rpm can be found on the first RedHat 7.0 disc. This will also require you to edit the Makefile to change the following line:

HOSTCC = gcc
Change to
HOSTCC = kgcc

If you have not already done so, please read the Warning: Read This First section of this document. To reiterate; I recommend backing up the following information:


How to backup what you have

Backing up your current information simply involves changing the name of the files in their current locations. For instance, to back up your /etc/System.map and /etc/config files:
cp /etc/System.map /etc/System.map.old
cp /etc/config /etc/config.old
Instead of using old you may want to append the kernel version number to the end of the above files.

If you downloaded a the sources for a new kernel, you should make sure the /usr/src/linux file is a symlink to the current kernel sources directory, and not the actual directory for your current kernel sources. If /usr/src/linux is the current kernel sources directory, move this directory to a new name:

mv /usr/src/linux /usr/src/2.2-16
This renames the kernel sources directory called linux to 2.2-16 which is the kernel version. You do not have to rename the file to the kernel version; you can call it whatever you like. Using the kernel version may make it easier for you to remember what you were doing or, if you have other versions of the kernel sources hanging around, what directory contains what version.

If /usr/src/linux is a symlink to another directory, you can delete this file.

If you are recompiling your current kernel, make sure you back up your old modules directory. For instance, using the 2.2-16 kernel as an example:

mv /lib/modules/2.2.16 /lib/modules/2.2.16.old
This will insure you can always go back to what you had if there is a problem.

Finally, make a backup copy of your boot loader configuration file. If you are using lilo here is an example:

cp /etc/lilo.conf /etc/lilo.conf.old

<- Back (Sources)   TOC    Next -> (Decompress)