RedHat 6.8 内核编译

/***************************************************************************
 *                      RedHat 6.8 内核编译
 * 说明:
 *     继上次编译RedHat 5.8之后,再编译一次RedHat 6.8看看情况。
 *
 *                                        2017-3-15 深圳 南山平山村 曾剑锋
 **************************************************************************/
一、参考文档:
    1. linux基础——在redhat6下配置yum源的使用 
        http://blog.itpub.net/23890223/viewspace-757724/
    2. redhat6.8 download:
        ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/
    3. Index of /centos/6/os/i386/Packages/
        http://mirrors.163.com/centos/6/os/i386/Packages/
    4. RHEL6编译升级官方内核
        http://blog.csdn.net/sailor201211/article/details/53747642
    5. 安装RPM套件rpm-build错误解决:NOKEY、elfutils is needed
        http://blog.chinaunix.net/uid-22539324-id-2644094.html

二、下载内核
    ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/

三、操作流程:
    [root@localhost ~]# groupadd mockbuild
    [root@localhost ~]# useradd -g mockbuild mockbuild
    [root@localhost ~]# rpm -ivh kernel-2.6.32-642.el6.src.rpm
    [root@localhost ~]# cd /root/rpmbuild/SPECS
    [root@localhost SPECS]# rpmbuild -bp --with fireware --target=`uname -m` kernel.spec
    Building target platforms: i686
    Building for target i686
    error: Failed build dependencies:
        elfutils-devel is needed by kernel-2.6.32-642.el6.i686
        audit-libs-devel is needed by kernel-2.6.32-642.el6.i686
    [root@localhost SPECS]# yum install elfutils-devel
    [root@localhost SPECS]# yum install audit-libs-devel
    [root@localhost SPECS]# rpmbuild -bp --with fireware --target=`uname -m` kernel.spec
    [root@localhost SPECS]# cd /root/rpmbuild/BUILD/kernel-2.6.32-642.el6/linux-2.6.32-642.el6.i686
    [root@localhost SPECS]# cp /boot/config-2.6.32-642.el6.i686 .config
    [root@localhost SPECS]# vim Makefile    # 修改版本后缀
    [root@localhost SPECS]# make && make modules_install && make install
    [root@localhost SPECS]# mkinitrd /boot/initrd-$(uname -r).img $(uname -r)
    [root@localhost grub]# cat grub.conf 
    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE:  You have a /boot partition.  This means that
    #          all kernel and initrd paths are relative to /boot/, eg.
    #          root (hd0,0)
    #          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
    #          initrd /initrd-[generic-]version.img
    #boot=/dev/sda
    default=1
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title Red Hat Enterprise Linux Server (2.6.32)
        root (hd0,0)
        kernel /vmlinuz-2.6.32 ro root=/dev/mapper/VolGroup-lv_root nomodeset rd_NO_LUKS rd_NO_MD rd_LVM_LV=VolGroup/lv_swap crashkernel=128M LANG=zh_CN.UTF-8 rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32.img
    title Red Hat Enterprise Linux 6 (2.6.32-642.el6.i686)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-642.el6.i686 ro root=/dev/mapper/VolGroup-lv_root nomodeset rd_NO_LUKS rd_NO_MD rd_LVM_LV=VolGroup/lv_swap crashkernel=128M LANG=zh_CN.UTF-8 rd_LVM_LV=VolGroup/lv_root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initrd-2.6.32-642.el6.i686.img
    [root@localhost grub]# 

 

posted on 2017-03-15 11:32  zengjf  阅读(1460)  评论(2编辑  收藏  举报

导航