CentOS 6.5 获取内核源码

1.安装依赖

yum install -y gcc bison patchutils rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed pesign xmlto audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel

2.创建内核源码树

mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

3.获取当前内核版本

uname -r
==>
2.6.32-431.el6.x86_64

4.获取内核源码rpm包

http://vault.centos.org/6.5/os/Source/SPackages/kernel-2.6.32-431.el6.src.rpm

备注:如果内核版本有小版本补丁,则对应地址为:

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

5.安装rpm至目录树

rpm -i kernel-2.6.32-431.el6.src.rpm 2>&1 | grep -v exist
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec

经过几分钟后内核源码应该在:

~/rpmbuild/BUILD/kernel-2.6.32-431.el6

 

你可能感兴趣的:(知识库,内核,centos)