筆者嘗試的方法有三種: php
附:kernel-2.6.32-279.9.1.tb1.el5.nosrc.zip linux
2、用Redhat/CentOS提供的內核源碼包,進行定製、編譯、安裝。 git
附:kernel-2.6.32-358.6.4.el6.nosrc.rpm.zip github
3、用原生linux內核進行定製、編譯、安裝。 centos
附:kernel-ml-3.9.7-1.el6.nosrc.rpm.zip 工具
千言萬語,不如直接裝上附的源碼包看吧。以CentOS的源碼包編譯爲例(nosrc.rpm須要本身去下載內核源碼): ui
# 安裝編譯所依賴的工具包 yum -y install @development-tools fedora-packager kernel-devel rpm-build redhat-rpm-config asciidoc hmaccalc binutils-devel elfutils-libelf-devel newt-devel zlib-devel xmlto python-devel perl-ExtUtils-Embed # 生成目錄:~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} 和文件 ~/.rpmmacros rpmdev-setuptree # CentOS 6 對應源碼目錄: http://ftp.redhat.com/redhat/linux/enterprise/6Server/en/os/SRPMS cd ~/rpmbuild/SRPMS/ # CentOS 6 當下最新,如下以此爲例 wget http://ftp.redhat.com/redhat/linux/enterprise/6Server/en/os/SRPMS/kernel-2.6.32-279.19.1.el6.src.rpm # 安裝內核源碼包 rpm -ivh ~/rpmbuild/SRPMS/kernel-2.6.32-279.19.1.el6.src.rpm # 使用rpmbuild就能夠一鍵編出你的內核到 ~/rpmbuild/RPMS/ 目錄中了 rpmbuild -bb --with baseonly --with firmware --without debuginfo ~/rpmbuild/SPECS/kernel.spec