2解压#tar -xjvf linux-2.6.35.9.tar.bz2
3放到内核源代码目录#mv linux-2.6.35.9 /usr/src/kernels
4编译准备
没有安装gcc不能make编译,所以首先还得#yum install gcc
#cd linux-2.6.30#make mrproper 清除环境变量,即清除配置文件
#make menuconfig 在菜单模式下选择需要编译的内核模块:
编译提示先装ncurses-devel
#yum install ncurses-devel
安装成功后再#make menuconfig 出现配置画面:
.config - Linux Kernel v2.6.35.9 Configuration
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
lqqqqqqqqqqqqqqqqqqqqqq Linux Kernel Configuration qqqqqqqqqqqqqqqqqqqqqqqk
x Arrow keys navigate the menu. <Enter> selects submenus --->. x
x Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, x
x <M> modularizes features. Press <Esc><Esc> to exit, <?> for Help, </> x
x for Search. Legend: [*] built-in [ ] excluded <M> module < > x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x General setup ---> x x
x x [*] Enable loadable module support ---> x x
x x -*- Enable the block layer ---> x x
x x Processor type and features ---> x x
x x Power management and ACPI options ---> x x
x x Bus options (PCI etc.) ---> x x
x x Executable file formats / Emulations ---> x x
x x -*- Networking support ---> x x
x x Device Drivers ---> x x
x x Firmware Drivers ---> x x
x mqqqqv(+)qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
x <Select> < Exit > < Help > x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
配置这个真头大,看配置手册配置项也太多了,很多设备都不知道什么用,看文档和配置手册配了几样(配置自己配,我也搞不清楚),保存退出。
配置参考。http://www.chinaunix.net/jh/4/16106.html保存就是保存.config.没有.config是不能编译的。如果有几个方案,保存多.config1,可以load.
修改.config文件
在.config文件搜索CONFIG_SYSFS_DEPRECATED_V2,会发现# CONFIG_SYSFS_DEPRECATED_V2 is not set这一行,将该行修改为CONFIG_SYSFS_DEPRECATED_V2=y
不然报错Volume group not found
5配置完了,开始编译
#make clean 确保所有东西均保持最新状态.
#make bzImage 生成内核文件
编译好久好久。出门吃饭逛了一圈回家编译完了
Root device is (253, 0)
Setup is 12664 bytes (padded to 12800 bytes).
System is 2399 kB
CRC 2d5d3d3f
Kernel: arch/x86/boot/bzImage is ready (#1)
#make modules 编译模块
又是一个难熬的过程。
#make modules_install 安装模块
#make install 安装
这两安装很快
#mkinitrd /boot/initrd_2.6.35.9.img 2.6.35.9根据内核版本和指定参数生成映像文件
似乎OK了。
然后配置grub启动。
#vi /etc/grub.conf
# 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=0 #此处1改为0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.35.9)
root (hd0,0)
kernel /vmlinuz-2.6.35.9 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.35.9.img
title CentOS (2.6.18-194.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-194.el5
module /vmlinuz-2.6.18-194.el5xen ro root=/dev/VolGroup00/LogVol00
module /initrd-2.6.18-194.el5xen.img
title CentOS-base (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-194.el5.img
OK。重启。
#reboot -i