Help File Library: Building and Installing a Linux Kernel in Red Hat
Written By: Brian Jones (a.k.a njcajun)
I was getting really frustrated building this kernel using the online and
hard copy resources, because they are sketchy in some parts (i.e.,
"depends on the system," "if you want," "might be a good idea"). So I
got together all of my resources in one place, sat down with the README
and CHANGES docs that come with the kernel, and decided to document, step
by step, the process I went through. Of course I don't go through every
config option the kernel has to offer, but if you need information on
each choice you have, enter 'xconfig' like I do below, and there's help all
along the way.
This was done on a fresh install of Red Hat Linux 7.0 on an AMD 700MHz, with
a Voodoo 3 3000 PCI, and 128MB RAM....
To accompish this task, perform the following steps.
Log in as root.
Download linux-2.4.0.tar.gz (or any other kernel) to your home directory. Since you should root, that's the /root directory.
Unpack the tarball with the following command:
tar xvzf linux-2.4.0.tar.gz
This will create a new directory in /root called linux.
Move to the diretcory with this command:
cd linux
Type
make mrproper
(This is per the instructions in the README that come with the kernel.)
Download an updated gcc from Red Hat or your distribution's site. The newser the gcc, the better the compiliation session will go. In this example, we will step through the sub-steps needed to install gcc from an RPM package.
In the directory where you stored the gcc RPM file, type:
rpm -Fvh gcc-2.96-69.i386.rpm
Verify the installation took effect by typing:
gcc --version
Next, surf to http://www.kernel.org and download the latest version of util-linux, which ever version is recommended in the Changes file that comes with the kernel.
After unzipping the util-linux package, install util-linux using these commands:
./configure
make
make install
Verified your version by typing:
fdformat --version
Also download the latest version of modutils from kernel.org.
Install modutils by typing:
rpm -Fvh modutils-2.4.0.i386.rpm
Verify the version:
'insmod -V'
(This output looks like default
USAGE output, but the first line of all this is the version.)
Repeat the RPM download and installation procedure for the latest versions of ksymoops and e2fsprogs.
If necessary (as specicifed in the CHANGES file), download and install the latest mkinitrd version
Type the following command:
rpm -Fvh mkinitrd-2.9-1.i386.rpm
Verify the version.
Type
make xconfig
to create the
.config file in the /linux directory.
Examine the top-level Makefile (using vi or emacs) to confirm special issues. In this example, the line export INSTALL_PATH=/boot was
commented out, so it was uncommented, as Red Hat puts its kernel and
files in /boot, not root (/).
Type
make dep
Ideally, there should be no errors as you will have downloaded and installed all the needed files by now.
Type
make bzImage
Type
make modules
Make a backup copy of your module directory before entering the next command:
make modules_install
Copy your new kernel (called bzImage) to the /home directory as a
backup using this commands: