Introduction to compile the rhel kernel

1)get kernel source code from longriver:

   cd /pbdf/ISO/redhat/betas/rhel5.5rc2/Server/SRC/DVD                           //RHEL5.5rc2 source code

2) Mount -o loop RHEL5.4-Server-20090819.0-SRPMS-DVD.iso /mnt

Cd /mnt/SRPM

[root@rx2660-1 SRPMS]# find * | grep kernel

kernel-2.6.18-164.el5.src.rpm                                                                                //this is the kernel source codes

Rpm -ivh kernel-2.6.18-164.el5.src.rpm //will get kernel source code and patches in SOURCE folder, and a spec in SPEC folder

3) rpmbuild -ba --target=x86_64 kernel-2.6.spec                                               //do everything

rpmbuild -bp --target=ia64 kernel-2.6.spec //only unpack the kernel and apply the patches.will put all of things into BUILD/kernel-2.6.18 folder

4)cd  /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.ia64

vi Makefile                                                                                                              //modify EXTRAVERSION to add  joe characters

5)  make menuconfig                                                                                                // add  ncurses-devel  rpm package

6)  make all                                                                                                                  //create the kernel image. Pay attention to a "make rpm" command

7)make modules_install                                                                                          //in /usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.ia64 folder

   //create  /lib/modules/2.6.18-prep-joe folder and  build ->/usr/src/redhat/BUILD/kernel-2.6.18/linux-2.6.18.ia64

8)make install                                                                                                        //copy vmlinuz-2.6.18-prep-joe System.map-2.6.18-prep-joe to /boot folder.

//copy initrd-2.6.18-prep-joe.img to /boot/efi/efi/redhat folder.

9)modify elilo.conf file                                                                                        //move vmlinuz-2.6.18-prep-joe from /boot to /boot/efi/efi/redhat folder

Exmaple: elilo.conf

prompt

timeout=20

relocatable

default=linux-joe

image=vmlinuz-2.6.18-194.el5

        label=linux

        initrd=initrd-2.6.18-194.el5.img

        read-only

        append="rhgb quiet root=LABEL=/1"

image=vmlinuz-2.6.18-prep-joe

        label=linux-joe

        initrd=initrd-2.6.18-prep-joe.img

        read-only

        append="rhgb quiet root=LABEL=/1"

10)make distclean   //clean

posted @ 2011-07-18 18:35  yub0yue  阅读(273)  评论(0编辑  收藏  举报