四、重新编译内核:
使用yum安装了kernel.x86_64、kernel-devel.x86_64、kernel-headers.x86_64 后,在/usr/src/kernel下会存在相应的内核目录,如2.6.32-220.13.1.el6.x86_64,执行make menuconfig也可以配置内核,但是在执行make时会有报错:“make[1]: *** No rule to make target `missing-syscalls'. Stop.”
出现这个错误的原因是:
You're trying to compile something that isn't a source tree (it's a headers tree from kernel-devel). Building a kernel requires that you install the srpm.
即没有在源码树下make,所存在的内核的目录只是headers,解决的办法是安装kernel src的rpm包。
3.3、编译和rebuild内核
cd /usr/src/kernels/linux-2.6.32-220.13.1.el6.x86_64
make clean && make mrproper
#使用当前系统的 config ,这样编译后的内核只不过是改变了 hash table 的值,并没有改变其它的东西。
cp /boot/config-2.6.32-220.13.1.el6.x86_64 ./.config
修改.config,第一行#改成# x86_64
Add a new line to the top of the config file that contains the hardware platform the kernel is built for (the output of uname -i). The line is preceded by a # sign.
For example, an x86_64 machine would have the following line added to the top of the config file。
rpmbuild -bb --target=$(uname -m) --with firmware kernel.spec
参数说明
bb: Build a binary package (after doing the %prep, %build, and %install stages).
kernel.spec:控制文件
因为修改了内核的名字,所以firmware将不匹配,解决的办法就是在编译的时候添加参数--with firmware。
bb和ba的区别,ba编译后做成*.rpm和src.rpm,bb编译后做成*.rpm,如果以后需要在这个内核的基础上这次修改,建议使用ba。
ba: Build binary and source packages (after doing the %prep, %build, and %install stages).
这个过程比较长,大概需要10G的硬盘空间,编译完成后,在RPM/目录下生成以下文件
kernel-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-devel-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-debug-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-firmware-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-debug-debuginfo-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-headers-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-debug-devel-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
perf-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-debuginfo-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
perf-debuginfo-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
kernel-debuginfo-common-x86_64-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
python-perf-2.6.32-220.13.1.el6.ipvs_20bit.x86_64.rpm
根据需要安装后,重启
IP Virtual Server version 1.2.1 (size=1048576)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn