首页 技术 正文
技术 2022年11月15日
0 收藏 479 点赞 2,553 浏览 1334 个字

版本号:1.0.1

作者:石硕

更新:2014-05-09 15:04:53

============================================================

出于工作须要。定制CentOS内核,以改进TCP的传输效率,怎样改进这里暂且不提,以下重点解说怎样获取源代码,编译。

1. 编译前的准备

以【root】用户安装下列组件:

su root

yum -y groupinstall "Development Tools"

yum -y install ncurses-devel qt-devel

yum -y install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto

yum -y install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel

yum -y install newt-devel python-devel zlib-devel

2. 安装内核的源码组件

【注】必须使用【非root】用户运行命令

rpm -i http://vault.centos.org/6.5/updates/Source/SPackages/kernel-2.6.32-431.11.2.el6.src.rpm 2>&1 | grep -v mock

附:kernel-2.6.32-431.11.2.el6.src.rpm 源在国外。下载速度可能会比較慢。能够借助BGP机房或VPN加速。

附源码地址:

http://vault.centos.org/6.5/os/Source/SPackages/

http://vault.centos.org/6.5/updates/Source/SPackages/

3. 解压及预备源码文件

【注】必须使用【非root】用户运行命令

cd ~/rpmbuild/SPECS

rpmbuild -bp –target=$(uname -m) kernel.spec

附:如今内核的源码文件夹树能够在 ~/rpmbuild/BUILD/kernel*/linux*/ 这个文件夹内找得到。

4. 编译新内核

【注】必须使用【非root】用户运行命令

cd ~/rpmbuild/SPECS

rpmbuild -bb –with baseonly –without debug –without debuginfo –target=`uname -m` kernel.spec 2> build-err.log | tee build-out.log

附:此过程可能须要花费90分钟左右,请耐心等待。

附:如今自己定义内核的 rpm 文件能够在 ~/rpmbuild/RPMS/`uname -m`/ 文件夹内找到。

5. 安装新内核

【注】必须使用【root】用户运行命令

su root

rpm -ivh kernel-*.rpm

6. 验证

重新启动,查看内核版本号

uname -a

參考资料:

[1]CentOS Wiki http://wiki.centos.org/zh/HowTos/Custom_Kernel#head-981e27f326384c58516d3b2051b225526bb0a50a

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,093
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,569
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,417
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,190
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,825
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,908