[root@vx tmp]# ll
total 87820
-rw-r--r-- 1 root root 89831454 Aug 6 21:45 kernel-2.6.18-238.19.1.el5.src.rpm
srwxr-xr-x 1 root root 0 Jul 25 18:15 mapping-root
[root@vx tmp]# pwd
/tmp
[root@vx tmp]# groupadd mockbuild
[root@vx tmp]# useradd -g mockbuild mockbuild
[root@vx tmp]# rpm -ivh kernel-2.6.18-238.19.1.el5.src.rpm
warning: kernel-2.6.18-238.19.1.el5.src.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
error: cannot create %sourcedir /usr/src/redhat/SOURCES
[root@vx tmp]# mkdir -p /usr/src/redhat/SOURCES
[root@vx tmp]# ll
total 87820
-rw-r--r-- 1 root root 89831454 Aug 6 21:45 kernel-2.6.18-238.19.1.el5.src.rpm
srwxr-xr-x 1 root root 0 Jul 25 18:15 mapping-root
[root@vx tmp]# pwd
/tmp
[root@vx tmp]# rpm -ivh kernel-2.6.18-238.19.1.el5.src.rpm
warning: kernel-2.6.18-238.19.1.el5.src.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
1:kernel ########################################### [100%]
[root@vx tmp]#
[root@vx tmp]#
[root@vx tmp]#
[root@vx tmp]# pwd
/tmp
[root@vx tmp]# ll
total 87820
-rw-r--r-- 1 root root 89831454 Aug 6 21:45 kernel-2.6.18-238.19.1.el5.src.rpm
srwxr-xr-x 1 root root 0 Jul 25 18:15 mapping-root
[root@vx tmp]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
309G 6.1G 287G 3% /
/dev/sda6 99M 13M 82M 14% /boot
tmpfs 2.0G 0 2.0G 0% /dev/shm
[root@vx tmp]# ll
total 87820
-rw-r--r-- 1 root root 89831454 Aug 6 21:45 kernel-2.6.18-238.19.1.el5.src.rpm
srwxr-xr-x 1 root root 0 Jul 25 18:15 mapping-root
[root@vx tmp]# yum list|grep unif
unifdef.x86_64 1.171-5.fc6 base
[root@vx tmp]# yum install unifdef.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror01.idc.hinet.net
* extras: mirror01.idc.hinet.net
* updates: mirror01.idc.hinet.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package unifdef.x86_64 0:1.171-5.fc6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
===============================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================
Installing:
unifdef x86_64 1.171-5.fc6 base 15 k
Transaction Summary
===============================================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 15 k
Is this ok [y/N]: y
Downloading Packages:
unifdef-1.171-5.fc6.x86_64.rpm | 15 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : unifdef 1/1
Installed:
unifdef.x86_64 0:1.171-5.fc6
Complete!
[root@vx tmp]# cd /usr/src/redhat/
[root@vx redhat]# ll
total 568
drwxr-xr-x 2 root root 573440 Aug 6 22:02 SOURCES
drwxr-xr-x 2 root root 4096 Aug 6 22:02 SPECS
[root@vx redhat]# cd SPECS/
[root@vx SPECS]# ll
total 1048
-rw-r--r-- 1 mockbuild mockbuild 1068426 Jul 10 2011 kernel-2.6.spec
[root@vx SPECS]# yum list|grep -i "rpm-build"
rpm-build.x86_64 4.4.2.3-28.el5_8 updates
[root@vx SPECS]# yum install rpm-build.x86_64
[root@vx SPECS]# rpmbuild -bp --target `uname -m` kernel-2.6.spec
Building target platforms: x86_64
Building for target x86_64
error: Failed build dependencies:
redhat-rpm-config is needed by kernel-2.6.18-238.19.1.el5.x86_64
[root@vx SPECS]# yum install redhat-rpm-config
[root@vx SPECS]# rpmbuild -bp --target `uname -m` kernel-2.6.spec
[root@vx SPECS]# cd /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
[root@vx linux-2.6.18.x86_64]# pwd
/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.x86_64
[root@vx linux-2.6.18.x86_64]# ll
total 356
drwxr-xr-x 26 root root 4096 Aug 6 22:24 arch
drwxr-xr-x 2 root root 4096 Aug 6 22:25 block
drwxr-xr-x 2 root root 4096 Aug 6 22:25 configs
-rw-r--r-- 2 root root 18693 Sep 20 2006 COPYING
-rw-r--r-- 1 root root 89651 Aug 6 22:24 CREDITS
drwxr-xr-x 4 root root 4096 Aug 6 22:25 crypto
drwxr-xr-x 59 root root 12288 Aug 6 22:24 Documentation
drwxr-xr-x 69 root root 4096 Aug 6 22:25 drivers
drwxr-xr-x 66 root root 4096 Aug 6 22:25 fs
drwxr-xr-x 44 root root 4096 Aug 6 22:24 include
drwxr-xr-x 2 root root 4096 Aug 6 22:25 init
drwxr-xr-x 2 root root 4096 Aug 6 22:25 ipc
-rw-r--r-- 2 root root 1273 Sep 20 2006 Kbuild
drwxr-xr-x 5 root root 4096 Aug 6 22:25 kernel
drwxr-xr-x 5 root root 4096 Aug 6 22:25 lib
-rw-r--r-- 1 root root 75155 Aug 6 22:24 MAINTAINERS
-rw-r--r-- 1 root root 48352 Aug 6 22:24 Makefile
drwxr-xr-x 2 root root 4096 Aug 6 22:25 mm
drwxr-xr-x 43 root root 4096 Aug 6 22:25 net
-rw-r--r-- 2 root root 16538 Sep 20 2006 README
-rw-r--r-- 2 root root 3065 Sep 20 2006 REPORTING-BUGS
drwxr-xr-x 4 root root 4096 Aug 6 22:24 samples
drwxr-xr-x 10 root root 4096 Aug 6 22:24 scripts
drwxr-xr-x 4 root root 4096 Aug 6 22:24 security
drwxr-xr-x 18 root root 4096 Aug 6 22:24 sound
drwxr-xr-x 3 root root 4096 Aug 6 22:24 tools
drwxr-xr-x 2 root root 4096 Aug 6 22:24 usr
[root@vx linux-2.6.18.x86_64]# cp configs/kernel-2.6.18-x86_64
kernel-2.6.18-x86_64.config kernel-2.6.18-x86_64-debug.config kernel-2.6.18-x86_64-xen.config
[root@vx linux-2.6.18.x86_64]# cp configs/kernel-2.6.18-x86_64.config .config
cp: overwrite `.config'? y
[root@vx linux-2.6.18.x86_64]# make menuconfig
HOSTLD scripts/kconfig/mconf
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/lxdialog.o
[root@vx linux-2.6.18.x86_64]# make -j8 bzImage > makebzimage.log 2>&1
[root@vx linux-2.6.18.x86_64]# make moudules > makemodules.log 2>&1
[root@vx linux-2.6.18.x86_64]# make modules > makemodules.log 2>&1
[root@vx linux-2.6.18.x86_64]# make modules_install > makemodulesinstall.log 2>&1
[root@vx linux-2.6.18.x86_64]# /sbin/depmod -ae -F System.map 2.6.18-prep
[root@vx linux-2.6.18.x86_64]# make install
sh /usr/src/redhat/BUILD/kernel-2.6.18/kernel-2.6.18-x86_64/arch/x86_64/boot/install.sh 2.6.18-prep arch/x86_64/boot/bzImage System.map "/boot"
[root@vx linux-2.6.18.x86_64]#
查看grub/lilo配置文件
ftp://ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/
ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/