(I've tested it in my computer: fedora7. It will generate two rpm packages: 1. /usr/src/redhat/SRPMS/kernel-2.6.21prep-1.src.rpm; 2. /usr/src/redhat/RPMS/i386/kernel-2.6.21prep-1.i386.rpm)
step 1: download the kernel source
The default kernel source can be found through any Fedora mirror. Look in the directory "/source/SRPMS/" under the "/7/" directory .
For example: http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Fedora/source/SRPMS/.
step 2: install the src.rpm
#rpm -ivh kernel-2.6.21-1.3194.fc7.src.rpm
step 3: install sparse
#yum install sparse
step 4:
#rpmbuild -bp --target=$(uname -m) /usr/src/redhat/SPECS/kernel-2.6.spec
step 5:
#make rpm
step 6:Install The New Kernel
#cd /usr/src/redhat/RPMS/i386/
#rpm -ivh kernel-2.6.21prep-1.i386.rpm
step 6:
#mkinitrd initrd-2.6.21-prep.img 2.6.21-prep
step 7:modify /boot/grub/menu.lst
step 8:reboot
#shutdown -r now
NOTES:
step 5:
INSTALL sound/pci/snd-cs4281.ko
INSTALL sound/pci/snd-ens1370.ko
INSTALL sound/pci/snd-ens1371.ko
INSTALL sound/pci/snd-es1938.ko
INSTALL sound/pci/snd-es1968.ko
INSTALL sound/pci/snd-fm801.ko
INSTALL sound/pci/snd-intel8x0.ko
INSTALL sound/pci/snd-intel8x0m.ko
INSTALL sound/pci/snd-maestro3.ko
INSTALL sound/pci/snd-rme32.ko
INSTALL sound/pci/snd-rme96.ko
INSTALL sound/pci/snd-sonicvibes.ko
INSTALL sound/pci/snd-via82xx-modem.ko
INSTALL sound/pci/snd-via82xx.ko
INSTALL sound/pci/trident/snd-trident-synth.ko
INSTALL sound/pci/trident/snd-trident.ko
INSTALL sound/pci/vx222/snd-vx222.ko
INSTALL sound/pci/ymfpci/snd-ymfpci.ko
INSTALL sound/soundcore.ko
INSTALL sound/synth/emux/snd-emux-synth.ko
INSTALL sound/synth/snd-util-mem.ko
INSTALL sound/usb/snd-usb-audio.ko
INSTALL sound/usb/snd-usb-lib.ko
INSTALL sound/usb/usx2y/snd-usb-usx2y.ko
if [ -r System.map -a -x /sbin/depmod ]; then /sbin/depmod -ae -F System.map -b /var/tmp/kernel-2.6.21prep-root -r 2.6.21-prep; fi
+ cp arch/i386/boot/bzImage /var/tmp/kernel-2.6.21prep-root/boot/vmlinuz-2.6.21-prep
+ cp System.map /var/tmp/kernel-2.6.21prep-root/boot/System.map-2.6.21-prep
+ cp .config /var/tmp/kernel-2.6.21prep-root/boot/config-2.6.21-prep
+ /usr/lib/rpm/brp-compress
Processing files: kernel-2.6.21prep-1
Provides: kernel-2.6.21-prep
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/kernel-2.6.21prep-root
Wrote: /usr/src/redhat/SRPMS/kernel-2.6.21prep-1.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/kernel-2.6.21prep-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.26551
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd kernel-2.6.21prep
+ exit 0
rm ../kernel-2.6.21prep.tar.gz
[root@fc7 linux-2.6.21.i686]#
[root@fc7 SRPMS]# ls -alh
total 56M
drwxr-xr-x 2 root root 4.0K 2007-11-05 15:22 .
drwxr-xr-x 7 root root 4.0K 2007-11-05 13:58 ..
-rw-r--r-- 1 root root 56M 2007-11-05 15:22 kernel-2.6.21prep-1.src.rpm
[root@fc7 SRPMS]# pwd
/usr/src/redhat/SRPMS
[root@fc7 i386]# ls -alh
total 169M
drwxr-xr-x 2 root root 4.0K 2007-11-05 15:27 .
drwxr-xr-x 8 root root 4.0K 2007-11-05 13:58 ..
-rw-r--r-- 1 root root 169M 2007-11-05 15:27 kernel-2.6.21prep-1.i386.rpm
[root@fc7 i386]# pwd
/usr/src/redhat/RPMS/i386