Compile Linux Kernel 2.6.31.5 on Centos 5.4
Share[root@server1 ~]# uname -a;date;uptime
Linux server1 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 athlon i386 GNU/Linux
Sat Oct 24 20:51:19 MYT 2009
20:51:19 up 4 min, 2 users, load average: 0.24, 0.36, 0.16
[root@server1 ~]# cat /etc/redhat-release
CentOS release 5.4 (Final)
Download Kernel file from kernel.org, but it depends on your internet connection.
[root@server1 ~]# cd /usr/src
[root@server1 src]# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.5.tar.bz2
–2009-10-24 20:56:56– http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.5.tar.bz2
Resolving www.kernel.org… 199.6.1.164, 204.152.191.37, 130.239.17.4, …
Connecting to www.kernel.org|199.6.1.164|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 61448996 (59M) [application/x-bzip2]
Saving to: `linux-2.6.31.5.tar.bz2′2% [> ] 1,554,891 212K/s eta 7m 18s
make sure that your system already have gcc.
[root@server1 src]# yum install gcc
Loaded plugins: fastestmirror
Determining fastest mirrors
* addons: centos.maulvi.net
* base: centos.maulvi.net
* extras: centos.maulvi.net
* updates: centos.maulvi.net
addons | 951 B 00:00
addons/primary | 201 B 00:00
base | 2.1 kB 00:00
base/primary_db | 1.6 MB 00:12
extras | 1.1 kB 00:00
extras/primary | 107 kB 00:00
extras 324/324
updates | 951 B 00:00
updates/primary | 202 B 00:00
Setting up Install Process
Package gcc-4.1.2-46.el5.i386 already installed and latest version
Nothing to do
Tar the file
[root@server1 src]# tar -xjvf linux-2.6.31.5.tar.bz2
[root@server1 linux-2.6.31.5]#make menuconfig
[root@server1 linux-2.6.31.5]# make
[root@server1 linux-2.6.31.5]# make modules
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
CALL scripts/checksyscalls.sh
Building modules, stage 2.
MODPOST 1019 modules[root@server1 linux-2.6.31.5]# make modules_install
[root@server1 linux-2.6.31.5]# make install
sh /usr/src/linux-2.6.31.5/arch/x86/boot/install.sh 2.6.31.5 arch/x86/boot/bzImage \
System.map “/boot”[root@server1 linux-2.6.31.5]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.31.5)
root (hd0,0)
kernel /vmlinuz-2.6.31.5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.31.5.img
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-164.el5.img
[root@server1 linux-2.6.31.5]#
Then rebooted your system.
