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
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
uname -r
==>
2.6.32-431.el6.x86_64
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/
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