下载后解压到/usr/src下: bzip2 -dc linux-2.6.24.4.tar.bz2 | tar xvf - 把文件夹linux-2.6.24.4改名字为:linux-kernel
随便在哪个文件夹下面,编写一个shell文件名叫a.sh,内容如下: #! /bin/bash mkdir -p /home/name/build/kernel cd /usr/src/linux-kernel make mrproper make O=/home/name/build/kernel menuconfig make O=/home/name/build/kernel sudo make O=/home/name/build/kernel modules_install install
之后修改grub.conf文件,让以后的系统用新的的内核启动: vim /etc/grub.conf 内容如下: # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You do not have a /boot partition. This means that # all kernel and initrd paths are relative to /, eg. # root (hd0,6) # kernel /boot/vmlinuz-version ro root=/dev/sda7 # initrd /boot/initrd-version.img #boot=/dev/sda default=2 timeout=5 splashimage=(hd0,6)/boot/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.24.4) root (hd0,6) kernel /boot/vmlinuz-2.6.24.4 ro root=LABEL=/ rhgb quiet initrd /boot/initrd-2.6.24.4.img title CentOS (2.6.18-53.el5) root (hd0,6) kernel /boot/vmlinuz-2.6.18-53.el5 ro root=LABEL=/ rhgb quiet initrd /boot/initrd-2.6.18-53.el5.img title Windows XP rootnoverify (hd0,0) chainloader +1