How compile a Kernel


The goal of this section is not to make a detailed explanation of the functions of the Kernel but a method to compile its Kernel in order to choose the most interesting functions.
 
First stage

Let us check that the system have the utilities necessary to the compilation of the Kernel.
 
 
control checking
Package RPM concerned
gcc -v ( or type gcc ) egcs-1.1.2-x.i386.rpm ( x relate to a value of the version of the package )
cpp-1.1.x.i386.rpm
make -v ( or type make ) make-3.77.x.i386.rpm ( x relate to a value of the version of the package )
automake --version ( or type automake ) automake-1.4.x.noarch.rpm ( x relate to a value of the version of the package )
type as86 dev86-0.14.x.i386.rpm ( x relate to a value of the version of the package )
patch -v ( or type patch ) patch-2.x.i386.rpm ( x relate to a value of the version of the package )

in case of make xconfig or make menuconfig
control checking
Package RPM concerned
ls -l /usr/include/strings.h glibc-devel-2.1.x.i386.rpm ( x relate to a value of the version of the package )
ls -l /usr/include/curses.h ncurses-devel-x.i386.rpm ( x relate to a value of the version of the package )

 
Second stage

Let us check that the sources of the Kernel are present on the distribution:
control checking
Package RPM concerned
rpm -qiv kernel-source kernel-source-2.2.xy.i386.rpm 
rpm -qiv modutils .modutils-2.3.9-6.i386.rpm ( recommended )

or well
if you wish to install a new Kernel (different from the sources from the distribution)
 

- copy the file of Kernel ( ftp or Cd-Rom)
ex: ftp://ftp.kernel.org/pub/linux/kernel/v2.2/linux-2.2.14.tar.gz
- move in the tree structure: cd /usr/src
- suppression of the symbolic link : rm linux
- creation of the directory source: mkdir linux-N°Kernel (ex: mkdir linux-2.2.14)
- creation of the symbolic link : ln -s linux-2.2.14 linux
- decompression of the file: tar xfvz /somewhere/linux-2.2.14.tar.gz


In the case of Proliant 2000 and Kernel 2.2.12, it is not integrated the card and chipset SIM710. You need patche the Kernel with the file sim710-991111.diff.bz2 (to be downloaded here).

- copy it in /usr/src: cp /somewhere/sim710-991111.diff.bz2 /usr/src
- move in the directory:cd /usr/src
- decompression of the patch: bzip2 sim710-991111.diff.bz2
- application of the patch:patch -p0 < sim710-991111.diff
Third stage

Now we will configure the Kernel:

- move in the directory: cd /usr/src/linux

there are three possible commands:

make config : in the case of a dumb terminal not managing neither color, nor graphics
make menuconfig : in the case of a terminal text, managing the colors
make xconfig : can be executed only on system X.


in the last case here the screen which will see appear:


The various sections propose options which will be three:

y: option directly integrated into Kernel
n: option desactivated
m: option integrated in the form of external module
Some Sections are significant in the case of our Compaq Proliant 2000.

section Processor type and features

section Loadable Module Support

section General Setup

section Networking

section SCSI Support

section SCSI low level drivers

section mice















These choices are significant but can be modified according to needs.
You can now make " Save and Exit ".
The options are stored in the file /usr/src/linux/.config
You can download the version of which I was useful myself
 
Config file for Kernel 2.2.12-20 2.2.12 here (rename it ".config")
Config file for Kernel 2.2.14-5.0 2.2.14 here (rename it ".config")
Config file for BOOT 2.2.12-20 BOOT 2.2.12 here (rename it ".config")
Config file for BOOT 2.2.14-5.0 BOOT 2.2.14 here (rename it ".config")

 
Fourth stage

Compilation itself  (move in the directory: cd /usr/src/linux)

There are two methods:
First method

make install: the command determines the dependences,
compiles the Kernel, automatically creates the links in the directory /boot like the command /sbin/installkernel
( ex: /sbin/installkernel 2.2.12-20 /usr/src/linux/arch/i386/boot/bzImage /usr/src/linux/System.map)
and carry out the command lilo - v.
CAUTION: In this case, edit the file /etc/lilo.conf before and to replace:
image=/boot/vmlinuz-2.2.12-20
by
image=/boot/vmlinuz
Second method
make dep : to determine the dependences
make clean : to remove the old file-objects
make bzImage : built the Kernel and stores it in /usr/src/linux/arch/i386/boot


(NB: In the case of the diskette of Boot-Redhat or Rescue-Redhat, copy the file /usr/src/linux/arch/i386/boot/bzImage from the diskette and rename it vmlinuz)

type the commands to remake the links of Boot:

- mv /boot/vmlinuz-2.2.12-20 /boot/vmlinuz.old
- mv /boot/System.map-2.2.12-20 /boot/System.map.old
- cat /usr/src/linux/arch/i386/boot/bzImage > /boot/vmlinuz-2.2.14
- cp /usr/src/linux/System.map /boot/System.map-2.2.14
- ln -fs vmlinuz-2.2.14 /boot/vmlinuz
- ln -fs System.map-2.2.14 /boot/System.map

Edit the file /etc/lilo.conf before and to replace:

image=/boot/vmlinuz-2.2.12-20
by
image=/boot/vmlinuz
- /sbin/lilo - v
Fifth stage

Construction of the modules: make modules
Installation of the modules:make modules_install

You can also use " linuxconf " to edit lilo.conf easily in order to start on various versions of the Kernel.

It any more but does not remain you to reboot (while having taken the precaution to have a diskette rescue for 6.0 or for 6.1 or for 6.2 under the hand).

Come back