RedHat 6.8 內核編譯

/***************************************************************************
 *                      RedHat 6.8 內核編譯
 * 說明:
 *     繼上次編譯RedHat 5.8以後,再編譯一次RedHat 6.8看看狀況。
 *
 *                                        2017-3-15 深圳 南山平山村 曾劍鋒
 **************************************************************************/
1、參考文檔:
    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

2、下載內核
    ftp://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/

3、操做流程:
    [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]# 
相關文章
相關標籤/搜索