Hints on Compiling the Kernel
1. Notes for the 2.4.x kernel
1.1 The general sequence of commands are:
make clean
make mrproper
make oldconfig -> to generate a .config file based on the running kernel
make menuconfig -> allow you to inspect/change the .config file
make dep
make bzImage
make modules
make modules_install
make install
2. Notes for the 2.6.x kernel
2.1 The general sequence of commands are:
# make clean
# make mrproper
# make oldconfig -> generate a .config file based on the running kernel
# make bzImage
# make modules
# make modules_install
# make install
3. Notes for the 2.6.x kernel and Fedora FC3
Fedora core 3 changed the way they distributed the source code. You
have to build the source tree using.
Example using kernel version 2.6.9-1.681_FC3 for Fedora Core3.
Following the direction in the release notes for getting source tree:
# rpm -ivh kernel-2.6.9-1.681_FC3.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild -bp --target=i686 kernel-2.6.spec <-- slightly difference from the release notes
# cd /usr/src/redhat/BUILD
Kernel soures is located in /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9/
Copy the tree to /usr/src/linux-2.6.x
# cd /usr/src/redhat/BUILD/kernel-2.6.9
# tar cf - linux-2.6.9 | ( cd /usr/src; tar xf - )
Then proceed as usual.
# cd /usr/src
# ln -s linux-2.6.9 linux-2.6
# cd /usr/src/linux-2.6
# make clean
# make mrproper
# make oldconfig -> generate a .config file based on the running kernel
# make bzImage
# make modules
# make modules_install
# make install
For some unknown reason it calls the kernel '2.6.9-prep'
The kernel name can be modified by editing /usr/src/linux-2.6/Makefile
4. Notes for 2.6.x kernel and CentOS 4.4
Download and install kernel source:
# wget http://mirrors.kernel.org/centos/4.4/updates/SRPMS/kernel-2.6.9-42.0.10.EL.src.rpm
# rpm -ivh kernel-2.6.9-42.0.10.EL.src.rpm
Prepare for commpilation
# rpmbuild -bp --target i686 /usr/src/redhat/SPECS/kernel-2.6.spec
# ln -s /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9 /usr/src/linux
# cd /usr/src/linux
# make mrproper
Compile & Install it:
# make oldconfig // this make the .config file using
# make modules modules_install install
Notes:
stock .config are located in: /usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9/configs
Edit /usr/src/linux/Makefile's EXTRAVERSION to rename kernel:
ie '-prep' to '-42.0.10.EL'
5. Getting the kernel source for CentOS 5.x
Download and install kernel source:
# wget http://mirrors.kernel.org/centos/5.5/updates/SRPMS/kernel-2.6.18-194.17.1.el5.src.rpm
# rpm -ivh kernel-2.6.18-194.17.1.el5.src.rpm | grep -v mockb
Prepare for commpilation
# rpmbuild -bp --target i686 /usr/src/redhat/SPECS/kernel-2.6.spec
# ln -s /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18 /usr/src/linux
# cd /usr/src/linux
# make mrproper