星期日, 11月 12, 2006

Steps to rebuild Fedora kernel

1. Install kernel-.src.rpm

2.Change directory to /usr/src/redhat/SPECS/, and issue the following command:
rpmbuild -bp --target= kernel.spec
-bp Executes the "%prep" stage from the spec file. Normally thisinvolves unpacking the sources and applying any patches.

3. In resulting tree, the configurations for the specific kernels shipped in Fedora Core 3 are in the /configs/ directory.
For example, the i686 SMP configuration file is named /configs/kernel--i686-smp.config. Issue the following command to place the desired configuration file in the proper place for building:
cp ./.config

4. The source will store at:/usr/src/redhat/BUILD/kernel-2.x.x/

5. 因為kernel.spec 要編譯所有的東西(包含說明文件、enterprise、smp、up、secure等等),所以它會花上很長的時間編譯。您可以進一步要求 kernel.spec 不要建立那些您不要的套件:您可以自己編輯 kernel.spec 檔案一開頭的部分,或者使用下面的指令: rpm -ba ––without enterprise ––without smp
-ba will build the binary and source package, ie. that is what people use after they create a spec file and build all the rpm/srpm(s) that are built in prereq's of the rpm.

6. The rpms will be output to/usr/src/redhat/RPMS

7. Install the new kernel