欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

编译内核

程序员文章站 2022-03-07 13:20:00
...

1、首先下载安装包
asciidoc-8.4.5-4.1.el6.noarch.rpm
Lvs-fullnat-synproxy.tar.gz
kernel-2.6.32-220.23.1.el6.src.rpm
slang-devel-2.2.1-1.el6.x86_64.rpm
newt-devel-0.52.11-3.el6.x86_64.rpm
2、安装
(1)rpm -ivh kernel-2.6.32-220.23.1.el6.src.rpm
编译内核
(2)

[[email protected] ~]# ls
kernel-2.6.32-220.23.1.el6.src.rpm  rpmbuild
[[email protected] ~]# cd rpmbuild/
[[email protected] rpmbuild]# s
-bash: s: command not found
[[email protected] rpmbuild]# ls
SOURCES  SPECS
[[email protected] rpmbuild]# cd SOURCES/
[[email protected] SOURCES]# ls
check-kabi              config-i686-nodebug-rhel     config-s390x               config-x86_64-generic-rhel         linux-kernel-test.patch
config-debug            config-i686-rhel             config-s390x-debug         config-x86_64-nodebug              Makefile.common
config-debug-rhel       config-ia64-generic-rhel     config-s390x-debug-rhel    config-x86_64-nodebug-rhel         Makefile.config
config-framepointer     config-nodebug               config-s390x-generic-rhel  config-x86-generic                 merge.pl
config-generic          config-nodebug-rhel          config-s390x-kdump         config-x86-generic-rhel            Module.kabi_i686
config-generic-rhel     config-powerpc64             config-s390x-kdump-rhel    extrakeys.pub                      Module.kabi_ppc64
config-i686             config-powerpc64-kdump       config-s390x-rhel          find-provides                      Module.kabi_s390x
config-i686-debug       config-powerpc64-rhel        config-x86_64-debug        genkey                             Module.kabi_x86_64
config-i686-debug-rhel  config-powerpc-generic       config-x86_64-debug-rhel   kabitool                           perf
config-i686-nodebug     config-powerpc-generic-rhel  config-x86_64-generic      linux-2.6.32-220.23.1.el6.tar.bz2  perf-archive
[[email protected] SOURCES]# cd ..
[[email protected] rpmbuild]# ls
SOURCES  SPECS

(3)

[root@server2 rpmbuild]# cd SPECS/
[root@server2 SPECS]# ls
kernel.spec

(4)[[email protected] SPECS]# yum install -y rpm-build
编译内核
(5)[[email protected] SPECS]# rpmbuild -bp kernel.spec 时发现缺少很多东西
编译内核
安装缺少的部分
[[email protected] SPECS]# yum install -y gcc redhat-rpm-config patchutils xmlto asciidoc elfutils-libelf-devel zlib-devel binutils-devel newt-devel python-devel hmaccalc perl-ExtUtils-Embed
编译内核
信息显示还缺少两个安装包 asciidoc 和 newt-devel
[[email protected] mnt]# yum install -u newt-devel-0.52.11-3.el6.x86_64.rpm slang-devel-2.2.1-1.el6.x86_64.rpm asciidoc-8.4.5-4.1.el6.noarch.rpm
编译内核
(6)[[email protected] mnt]# yum install -y newt-devel-0.52.11-3.el6.x86_64.rpm slang-devel-2.2.1-1.el6.x86_64.rpm asciidoc-8.4.5-4.1.el6.noarch.rpm
编译内核
(7)

[root@server2 mnt]# cd
[root@server2 ~]# ls
kernel-2.6.32-220.23.1.el6.src.rpm  rpmbuild
[root@server2 ~]# cd rpmbuild/
[root@server2 rpmbuild]# ls
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
[root@server2 rpmbuild]# cd SPECS/
[root@server2 SPECS]# ls
kernel.spec
[root@server2 SPECS]# rpmbuild -bp kernel.spec 

编译内核
中间停止不动时重新打开一个窗口连接主机
[[email protected] ~]# yum install -y rng-tools
编译内核
再输入这个命令,刚才停止的就会退出
[[email protected] ~]# rngd -r /dev/urandom
(8)

[[email protected] mnt]# tar zxf Lvs-fullnat-synproxy.tar.gz 
[[email protected] mnt]# cd lvs-fullnat-synproxy/
[[email protected] lvs-fullnat-synproxy]# ls
lvs-2.6.32-220.23.1.el6.patch  lvs-tools.tar.gz  README  toa-2.6.32-220.23.1.el6.patch
[[email protected] lvs-fullnat-synproxy]# cp lvs-2.6.32-220.23.1.el6.patch /root/rpmbuild/
BUILD/     BUILDROOT/ RPMS/      SOURCES/   SPECS/     SRPMS/     
[[email protected] lvs-fullnat-synproxy]# cp lvs-2.6.32-220.23.1.el6.patch /root/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/
[[email protected] lvs-fullnat-synproxy]# cd /root/rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/
[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# ls
arch                      config-nodebug-rhel          config-x86_64-generic       init                           perf
block                     config-powerpc64             config-x86_64-generic-rhel  ipc                            pubring.gpg
check-kabi                config-powerpc64-kdump       config-x86_64-nodebug       kabitool                       random_seed
config-debug              config-powerpc64-rhel        config-x86_64-nodebug-rhel  Kbuild                         README
config-debug-rhel         config-powerpc-generic       config-x86-generic          kernel                         REPORTING-BUGS
config-framepointer       config-powerpc-generic-rhel  config-x86-generic-rhel     kernel.pub                     samples
config-generic            configs                      COPYING                     kernel.pub~                    scripts
config-generic-rhel       config-s390x                 CREDITS                     kernel.sec                     secring.gpg
config-i686               config-s390x-debug           crypto                      lib                            security
config-i686-debug         config-s390x-debug-rhel      Documentation               lvs-2.6.32-220.23.1.el6.patch  sound
config-i686-debug-rhel    config-s390x-generic-rhel    drivers                     MAINTAINERS                    temp-i686-debug-final
config-i686-nodebug       config-s390x-kdump           extract.pub                 Makefile                       temp-i686-final
config-i686-nodebug-rhel  config-s390x-kdump-rhel      extrakeys.pub               Makefile.common                tools
config-i686-rhel          config-s390x-rhel            firmware                    merge.pl                       trustdb.gpg
config-ia64-generic-rhel  config-x86_64-debug          fs                          mm                             usr
config-nodebug            config-x86_64-debug-rhel     include                     net                            virt

(9)[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# patch -p1 < lvs-2.6.32-220.23.1.el6.patch
编译内核
(10)[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# vim Makefile
(11)make进行编译
[[email protected] linux-2.6.32-220.23.1.el6.x86_64]# make

相关标签: 内核