下载地址:
http://vault.centos.org/6.4/os/Source/SPackages/kernel-2.6.32-358.el6.src.rpm
安装
useradd mockbuild
su mockbuild
rpm -ivh kernel-2.6.32-358.el6.src.rpm
【这时会产生目录/home/mockbuild/rpmbuild/SOURCES和/home/mockbuild/rpmbuild/SPECS】
重建
cd /home/mockbuild/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
【源代码产生在目录/home/mockbuild/rpmbuild/BUILD/kernel-2.6.32-358.el6下,此目录有两个子目录:linux-2.6.32-358.el6.x86_64和vanilla-2.6.32-358.el6,后者是纯粹的源码,无法编译;后者是加了.config文件和key信息的可直接编译的源码】
error: Failed build dependencies:
patchutils is needed by kernel-2.6.32-504.el6.x86_64
xmlto is needed by kernel-2.6.32-504.el6.x86_64
asciidoc is needed by kernel-2.6.32-504.el6.x86_64
elfutils-libelf-devel is needed by kernel-2.6.32-504.el6.x86_64
elfutils-devel is needed by kernel-2.6.32-504.el6.x86_64
binutils-devel is needed by kernel-2.6.32-504.el6.x86_64
newt-devel is needed by kernel-2.6.32-504.el6.x86_64
python-devel is needed by kernel-2.6.32-504.el6.x86_64
audit-libs-devel is needed by kernel-2.6.32-504.el6.x86_64
perl(ExtUtils::Embed) is needed by kernel-2.6.32-504.el6.x86_64
bison is needed by kernel-2.6.32-504.el6.x86_64
flex is needed by kernel-2.6.32-504.el6.x86_64
hmaccalc is needed by kernel-2.6.32-504.el6.x86_64
要安装全部的包
perl(ExtUtils::Embed) = yum install -y perl-ExtUtils-Embed