4,436
社区成员
发帖
与我相关
我的任务
分享
下载Linux-2.6.32-220.23.1.el6.x86_64.rs.src.tar.gz和kernel-2.6.32-220.23.1.el6.src.rpm到/usr/local/src
1、安装kernel-2.6.32-220.23.1.el6.src.rpm
rpm -ivh /usr/local/src/kernel-2.6.32-220.23.1.el6.src.rpm
2、生成内核源码目录(需要安装相关依赖包)
rpmbuild -bp ~/rpmbuild/SPECS/kernel.spec
3、复制一份源码目录
cd ~/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/
cp -a linux-2.6.32-220.23.1.el6.x86_64/ linux-2.6.32-220.23.1.el6.x86_64_new
4、在复制出来的源码目录中打阿里提供的toa补丁
cd ~/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64_new/
patch -p1 < /usr/local/src/linux-2.6.32-220.23.1.el6.x86_64.rs/toa-2.6.32-220.23.1.el6.patch
5、编辑.config
#在linux-2.6.32-220.23.1.el6.x86_64_new中
sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config
echo -e '\n# toa\nCONFIG_TOA=m' >> .config
6、拷贝.config至SOURCE
#在linux-2.6.32-220.23.1.el6.x86_64_new中,会提示覆盖,直接覆盖即可
cp .config ~/rpmbuild/SOURCES/config-x86_64-generic
7、删除原始源码中的.config
cd ~/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64
rm -rf .config
8、生成最终的patch
cd ~/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/
diff -uNr linux-2.6.32-220.23.1.el6.x86_64 linux-2.6.32-220.23.1.el6.x86_64_new/ > ~/rpmbuild/SOURCES/toa.patch
9、编辑KERNEL.SPEC
vim ~/rpmbuild/SPECS/kernel.spec
%define distro_build rs.shanks
Patch999999: toa.patch
ApplyOptionalPatch toa.patch
10、打rpm包
rpmbuild -bb --with baseonly --without kabichk --with firmware --without debuginfo --target=x86_64 ~/rpmbuild/SPECS/kernel.spec
11、加载toa模块
vim /etc/sysconfig/modules/toa.modules
#!/bin/bash
modprobe toa >/dev/null 2>&1
chmod u+x /etc/sysconfig/modules/toa.modules