前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos 6 编译安装内核

centos 6 编译安装内核

作者头像
用户6792968
发布2022-08-30 12:17:13
1.5K0
发布2022-08-30 12:17:13
举报
文章被收录于专栏:fred 随笔fred 随笔

一、基础环境配置

1、配置yum源(centos6官方已经下架,不在维护,yum源需要配置到备用源)
代码语言:javascript
复制
[root@centos6 ~]# cat /etc/yum.repos.d/CentOS-
CentOS-Base.repo       CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo      CentOS-Vault.repo
[root@centos6 ~]# cd /etc/yum.repos.d/
[root@centos6 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-fasttrack.repo  CentOS-Media.repo  CentOS-Vault.repo
[root@centos6 yum.repos.d]# mkdir backup
[root@centos6 yum.repos.d]# mv * backup/
mv: 无法将目录"backup" 移动至自身的子目录"backup/backup" 下
[root@centos6 yum.repos.d]# ls
backup
[root@centos6 yum.repos.d]#
[root@centos6 yum.repos.d]# vim CentOS-Base.repo

[base]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-6.10
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[root@centos6 yum.repos.d]#
[root@centos6 yum.repos.d]# vim epel.repo

[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
enabled=1
failovermethod=priority
baseurl=http://mirrors.aliyun.com/epel-archive/6/$basearch
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/epel-archive/RPM-GPG-KEY-EPEL-6

[root@centos6 yum.repos.d]#
[root@centos6 yum.repos.d]# ls
backup  CentOS-Base.repo  epel.repo
[root@centos6 yum.repos.d]# yum clean all
已加载插件:fastestmirror, security
Cleaning repos: base epel extras updates
清理一切
[root@centos6 yum.repos.d]# yum makecache
已加载插件:fastestmirror, security
Determining fastest mirrors
base                                                                                                                                    | 3.7 kB     00:00
base/group_gz                                                                                                                           | 242 kB     00:00
base/filelists_db                                                                                                                       | 6.4 MB     00:01
base/primary_db                                                                                                                         | 4.7 MB     00:01
base/other_db                                                                                                                           | 2.8 MB     00:00
epel                                                                                                                                    | 4.7 kB     00:00
epel/group_gz                                                                                                                           |  74 kB     00:00
epel/filelists_db                                                                                                                       | 7.9 MB     00:17
epel/updateinfo                                                                                                                         | 788 kB     00:00
epel/prestodelta                                                                                                                        |  574 B     00:00
epel/primary_db                                                                                                                         | 6.1 MB     00:01
epel/other_db                                                                                                                           | 3.0 MB     00:00
extras                                                                                                                                  | 3.4 kB     00:00
extras/filelists_db                                                                                                                     |  24 kB     00:00
extras/prestodelta                                                                                                                      | 2.2 kB     00:00
extras/primary_db                                                                                                                       |  29 kB     00:00
extras/other_db                                                                                                                         |  14 kB     00:00
updates                                                                                                                                 | 3.4 kB     00:00
updates/filelists_db                                                                                                                    | 8.4 MB     00:02
updates/prestodelta                                                                                                                     | 357 kB     00:00
updates/primary_db                                                                                                                      |  12 MB     00:02
updates/other_db                                                                                                                        | 479 kB     00:00
元数据缓存已建立
2、下载gcc相关源码包
代码语言:javascript
复制
[root@centos6 ~]# mkdir packages
[root@centos6 ~]# cd packages/
[root@centos6 packages]# wget http://mirror.linux-ia64.org/gnu/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.gz
--2021-07-08 03:14:19--  http://mirror.linux-ia64.org/gnu/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.gz
正在解析主机 mirror.linux-ia64.org... 37.193.156.169
正在连接 mirror.linux-ia64.org|37.193.156.169|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:123208571 (118M) [application/x-gzip]
正在保存至: “gcc-5.4.0.tar.gz”

 3% [===>                                                                                                                  ] 4,846,713   1.41M/s eta(英国中部时 
 3% [===>                           
 。。。
 99% [====================================================================================================================> ] 122,555,257 2.45M/s eta(英国中部时99% [====================================================================================================================> ] 123,064,697 2.46M/s eta(英国中部时100%[=====================================================================================================================>] 123,208,571 2.47M/s   in 62s

2021-07-08 03:15:21 (1.90 MB/s) - 已保存 “gcc-5.4.0.tar.gz” [123208571/123208571])

[root@centos6 packages]# ls
gcc-5.4.0.tar.gz
[root@centos6 packages]# wget ftp://ftp.gnu.org/gnu/gmp/gmp-4.3.2.tar.bz2
--2021-07-08 03:17:06--  ftp://ftp.gnu.org/gnu/gmp/gmp-4.3.2.tar.bz2
           => “gmp-4.3.2.tar.bz2”
正在解析主机 ftp.gnu.org... 209.51.188.20, 2001:470:142:3::b
正在连接 ftp.gnu.org|209.51.188.20|:21... 已连接。
正在以 anonymous 登录 ... 登录成功!
==> SYST ... 完成。    ==> PWD ... 完成。
==> TYPE I ... 完成。  ==> CWD (1) /gnu/gmp ... 完成。
==> SIZE gmp-4.3.2.tar.bz2 ... 1897483
==> PASV ... 完成。    ==> RETR gmp-4.3.2.tar.bz2 ... 完成。
长度:1897483 (1.8M) (非正式数据)

13% [==============>                                                                                                       ] 254,512     82.5K/s eta(英国中部时
14% [===============>                                                                                                      ] 271,524     80.6K/s eta(英国中部时
15% [=================>                                                                                                    ] 295,168     69.9K/s eta(英国中部时
。。。
99% [====================================================================================================================> ] 1,881,792   48.0K/s eta(英国中部时100%[=====================================================================================================================>] 1,897,483   48.8K/s eta(英国中部时100%[=====================================================================================================================>] 1,897,483   48.8K/s   in 44s

2021-07-08 03:17:54 (42.1 KB/s) - “gmp-4.3.2.tar.bz2” 已保存 [1897483]

[root@centos6 packages]#  ls
gcc-5.4.0.tar.gz  gmp-4.3.2.tar.bz2
[root@centos6 packages]# wget http://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2
--2021-07-08 03:19:30--  http://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2
正在解析主机 www.mpfr.org... 152.81.144.155
正在连接 www.mpfr.org|152.81.144.155|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 301 Moved Permanently
位置:https://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2 [跟随至新的 URL]
--2021-07-08 03:19:32--  https://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2
正在连接 www.mpfr.org|152.81.144.155|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1077886 (1.0M) [application/x-bzip2]
正在保存至: “mpfr-2.4.2.tar.bz2”

 3% [===>                                                                                                                  ] 38,178      11.5K/s eta(英国中部时 4% [====>                                                                                                                 ] 46,178      12.7K/s eta(英国中部时 5% [====>                                                                                                                 ] 54,178      13.6K/s eta(英国中部时 6% [======>                                                                                                               ] 65,536      15.2K/s eta(英国中部时 7% [=======>                                                                                                              ] 78,178      16.9K/s eta(英国中部时 7% [========>                                                                                                             ] 86,178      17.4K/s eta(英国中部时 9% [=========>                                                                                                            ] 98,304      18.6K/s eta(英国中部时10% [===========>                                                                                                          ] 110,178     19.6K/s eta(英国中部时11% [============>                                                                                                         ] 122,880     20.7K/s eta(英国中部时12% [==============>                                                                                                       ] 139,264     22.2K/s eta(英国中部时14% [================>                                                                                                     ] 155,648     23.6K/s eta(英国中部时16% [==================>                                                                                                   ] 174,178     25.2K/s eta(英国中部时18% [====================>                                                                                                 ] 196,608     36.8K/s eta(英国中部时19% [======================>                                                                                               ] 214,178     40.3K/s eta(英国中部时22% [=========================>                                                                                            ] 245,760     46.2K/s eta(英国中部时25% [============================>                                                                                         ] 270,178     50.6K/s eta(英国中部时28% [================================>                                                                                     ] 310,178     58.8K/s eta(英国中部时31% [====================================>                                                                                 ] 344,064     68.1K/s eta(英国中部时36% [=========================================>                                                                            ] 390,178     78.0K/s eta(英国中部时41% [===============================================>                                                                      ] 442,368     95.6K/s eta(英国中部时47% [======================================================>                                                               ] 510,178      110K/s eta(英国中部时52% [============================================================>                                                         ] 566,178      129K/s eta(英国中部时59% [=====================================================================>                                                ] 646,178      147K/s eta(英国中部时67% [==============================================================================>                                       ] 729,088      166K/s eta(英国中部时74% [======================================================================================>                               ] 802,816      188K/s eta(英国中部时83% [=================================================================================================>                    ] 901,120      211K/s eta(英国中部时93% [=============================================================================================================>        ] 1,007,616    234K/s eta(英国中部时100%[=====================================================================================================================>] 1,077,886    254K/s   in 10s

2021-07-08 03:19:48 (102 KB/s) - 已保存 “mpfr-2.4.2.tar.bz2” [1077886/1077886])

[root@centos6 packages]# wget https://mirrors.sjtug.sjtu.edu.cn/gnu/mpc/mpc-1.0.1.tar.gz
--2021-07-08 03:20:44--  https://mirrors.sjtug.sjtu.edu.cn/gnu/mpc/mpc-1.0.1.tar.gz
正在解析主机 mirrors.sjtug.sjtu.edu.cn... 202.120.58.155
正在连接 mirrors.sjtug.sjtu.edu.cn|202.120.58.155|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:624125 (609K) [application/gzip]
正在保存至: “mpc-1.0.1.tar.gz”

100%[=====================================================================================================================>] 624,125     1.87M/s   in 0.3s

2021-07-08 03:20:45 (1.87 MB/s) - 已保存 “mpc-1.0.1.tar.gz” [624125/624125])

[root@centos6 packages]# ls
gcc-5.4.0.tar.gz  gmp-4.3.2.tar.bz2  mpc-1.0.1.tar.gz  mpfr-2.4.2.tar.bz2
[root@centos6 packages]# tar xf gcc-5.4.0.tar.gz
[root@centos6 packages]# tar xf gmp-4.3.2.tar.bz2
[root@centos6 packages]# tar xf mpc-1.0.1.tar.gz
[root@centos6 packages]# tar xf mpfr-2.4.2.tar.bz2
3、编译安装gcc组件
代码语言:javascript
复制
[root@centos6 packages]# cd gmp-4.3.2
[root@centos6 gmp-4.3.2]# mkdir build
[root@centos6 gmp-4.3.2]# cd build/
[root@centos6 build]#
[root@centos6 build]# ../configure --prefix=/usr/local/gmp-4.3.2
checking compiler icc -no-gcc ... no
checking compiler cc -O ... no
configure: error: could not find a working compiler, see config.log for details
#报错了,缺失基础版本gcc
[root@centos6 build]# yum install gcc  gcc-c++ -y
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
,,,
已安装:
  gcc.x86_64 0:4.4.7-23.el6                                                    gcc-c++.x86_64 0:4.4.7-23.el6

作为依赖被安装:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6  cpp.x86_64 0:4.4.7-23.el6  libstdc++-devel.x86_64 0:4.4.7-23.el6  mpfr.x86_64 0:2.4.1-6.el6  ppl.x86_64 0:0.10.2-11.el6

完毕!
[root@centos6 build]# ../configure --prefix=/usr/local/gmp-4.3.2
config.status: linking ../mpn/generic/addsub_n.c to mpn/addsub_n.c
config.status: linking ../mpn/x86_64/addaddmul_1msb0.asm to mpn/addaddmul_1msb0.asm
config.status: linking ../mpn/x86_64/gmp-mparam.h to gmp-mparam.h
[root@centos6 build]#
[root@centos6 build]# make && make install
,,,
+-------------------------------------------------------------+
| CAUTION:                                                    |
|                                                             |
| If you have not already run "make check", then we strongly  |
| recommend you do so.                                        |
|                                                             |
| GMP has been carefully tested by its authors, but compilers |
| are all too often released with serious bugs.  GMP tends to |
| explore interesting corners in compilers and has hit bugs   |
| on quite a few occasions.                                   |
|                                                             |
+-------------------------------------------------------------+

make[4]: Leaving directory `/root/packages/gmp-4.3.2/build'
make[3]: Leaving directory `/root/packages/gmp-4.3.2/build'
make[2]: Leaving directory `/root/packages/gmp-4.3.2/build'
make[1]: Leaving directory `/root/packages/gmp-4.3.2/build'

[root@centos6 build]# cd ../..
[root@centos6 packages]# cd mpfr-2.4.2
[root@centos6 mpfr-2.4.2]# mkdir build
[root@centos6 mpfr-2.4.2]# cd build/
[root@centos6 build]# ../configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2
,,,
checking if gmp_printf supports "%td"... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tests/Makefile
config.status: creating mparam.h
config.status: executing depfiles commands
config.status: executing libtool commands
[root@centos6 build]# make && make install
,,,
test -z "/usr/local/mpfr-2.4.2/share/doc/mpfr" || /bin/mkdir -p "/usr/local/mpfr-2.4.2/share/doc/mpfr"
/bin/mkdir -p '/usr/local/mpfr-2.4.2/share/doc/mpfr/examples'
 /usr/bin/install -c -m 644  ../examples/ReadMe ../examples/divworst.c ../examples/rndo-add.c ../examples/sample.c '/usr/local/mpfr-2.4.2/share/doc/mpfr/examples'
 /usr/bin/install -c -m 644  ../AUTHORS ../BUGS ../COPYING ../COPYING.LIB ../FAQ.html ../NEWS ../TODO '/usr/local/mpfr-2.4.2/share/doc/mpfr/.'
make[2]: Leaving directory `/root/packages/mpfr-2.4.2/build'
make[1]: Leaving directory `/root/packages/mpfr-2.4.2/build'
[root@centos6 build]# cd ../..
[root@centos6 packages]# cd mpc-1.0.1
[root@centos6 mpc-1.0.1]# mkdir build
[root@centos6 mpc-1.0.1]# cd build/
[root@centos6 build]# ../configure --prefix=/usr/local/mpc-1.0.1 --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2

checking gcc version... 4.4.7
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
[root@centos6 build]# make && make install
make[2]: Leaving directory `/root/packages/mpc-1.0.1/build/doc'
make[1]: Leaving directory `/root/packages/mpc-1.0.1/build/doc'
make[1]: Entering directory `/root/packages/mpc-1.0.1/build'
make[2]: Entering directory `/root/packages/mpc-1.0.1/build'
make[2]: Nothing to be done for `install-exec-am'.
 /bin/mkdir -p '/usr/local/mpc-1.0.1/include'
 /usr/bin/install -c -m 644 ../src/mpc.h '/usr/local/mpc-1.0.1/include'
make[2]: Leaving directory `/root/packages/mpc-1.0.1/build'
make[1]: Leaving directory `/root/packages/mpc-1.0.1/build'

[root@centos6 ~]# vim .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-4.3.2/lib:/usr/local/mpc-1.0.1/lib:/usr/local/mpfr-2.4.2/lib
[root@centos6 ~]# source .bashrc
[root@centos6 build]# cd ../..
[root@centos6 packages]# cd gcc-5.4.0
[root@centos6 gcc-5.4.0]# mkdir build
[root@centos6 gcc-5.4.0]# cd build/
[root@centos6 build]# ../configure --prefix=/usr/local/gcc-5.4.0 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-1.0.1
,,,
checking where to find the target windmc... host tool
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile
[root@centos6 build]# make && make install
。。。
pecify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[4]: Nothing to be done for `install-data-am'.
make[4]: Leaving directory `/root/packages/gcc-5.4.0/build/x86_64-unknown-linux-gnu/libatomic'
make[3]: Leaving directory `/root/packages/gcc-5.4.0/build/x86_64-unknown-linux-gnu/libatomic'
make[2]: Leaving directory `/root/packages/gcc-5.4.0/build/x86_64-unknown-linux-gnu/libatomic'
make[1]: Leaving directory `/root/packages/gcc-5.4.0/build'
[root@centos6 build]# cd
[root@centos6 ~]#
[root@centos6 ~]# mkdir /usr/gcc447backup/
[root@centos6 ~]# mv /usr/bin/{gcc,g++} /usr/gcc447backup
[root@centos6 ~]# ln -s /usr/local/gcc-5.4.0/bin/gcc /usr/bin/gcc
[root@centos6 ~]# ln -s /usr/local/gcc-5.4.0/bin/g++ /usr/bin/g++
[root@centos6 ~]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-5.4.0/libexec/gcc/x86_64-unknown-linux-gnu/5.4.0/lto-wrapper
目标:x86_64-unknown-linux-gnu
配置为:../configure --prefix=/usr/local/gcc-5.4.0 --enable-threads=posix --disable-checking --disable-multilib --enable-languages=c,c++ --with-gmp=/usr/local/gmp-4.3.2 --with-mpfr=/usr/local/mpfr-2.4.2 --with-mpc=/usr/local/mpc-1.0.1
线程模型:posix
gcc 版本 5.4.0 (GCC)
4、编译kernel内核
代码语言:javascript
复制
[root@centos6 ~]# cd packages/
[root@centos6 packages]# wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.13.2.tar.gz
--2021-07-09 01:02:26--  https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.13.2.tar.gz
正在解析主机 mirrors.edge.kernel.org... 147.75.95.133, 2604:1380:3000:1500::1
正在连接 mirrors.edge.kernel.org|147.75.95.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:155505752 (148M) [application/x-gzip]
正在保存至: “linux-4.13.2.tar.gz”

 2% [=>                                                                                                                    ] 3,243,629   1.03M/s eta(英国中部时 
 2% [=>                                                                                                                    ] 3,440,237   1020K/s eta(英国中部时
 2021-07-09 01:20:15 (142 KB/s) - 已保存 “linux-4.13.2.tar.gz” [155505752/155505752])

[root@centos6 packages]# tar xf linux-4.13.2.tar.gz
[root@centos6 packages]# cd linux-4.13.2
[root@centos6 linux-4.13.2]# ls
arch   certs    CREDITS  Documentation  firmware  include  ipc     Kconfig  lib          Makefile  net     samples  security  tools  virt
block  COPYING  crypto   drivers        fs        init     Kbuild  kernel   MAINTAINERS  mm        README  scripts  sound     usr
# 以系统上原有的操作系统为模板,拷一个模板文件到我们的目录,并命名为.config的隐藏文件
[root@centos6 linux-4.13.2]# cp /boot/config-2.6.32-754.el6.x86_64 ./.config
[root@centos6 linux-4.13.2]# make menuconfig
  HOSTCC  scripts/basic/fixdep
 *** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
make[1]: *** [scripts/kconfig/dochecklxdialog] 错误 1
make: *** [menuconfig] 错误 2

[root@centos6 linux-4.13.2]# yum install ncurses-devel ncurses -y
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
base                                                                                                                                    | 3.7 kB     00:00
epel                                                                                                                                    | 4.7 kB     00:00
extras                                                                                                                                  | 3.4 kB     00:00
updates                                                                                                                                 | 3.4 kB     00:00
包 ncurses-5.7-4.20090207.el6.x86_64 已安装并且是最新版本
解决依赖关系
--> 执行事务检查
---> Package ncurses-devel.x86_64 0:5.7-4.20090207.el6 will be 安装
--> 完成依赖关系计算

执行事务
  正在安装   : ncurses-devel-5.7-4.20090207.el6.x86_64                                                                                                     1/1
  Verifying  : ncurses-devel-5.7-4.20090207.el6.x86_64                                                                                                     1/1

已安装:
  ncurses-devel.x86_64 0:5.7-4.20090207.el6

完毕!
[root@centos6 linux-4.13.2]# make menuconfig
代码语言:javascript
复制
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[root@centos6 linux-4.13.2]# make
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/sign-file
scripts/sign-file.c:25:30: 致命错误:openssl/opensslv.h:没有那个文件或目录
编译中断。
make[1]: *** [scripts/sign-file] 错误 1
make: *** [scripts] 错误 2
[root@centos6 linux-4.13.2]# yum install openssl  openssl-devel -y
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package openssl.x86_64 0:1.0.1e-57.el6 will be 升级
---> Package openssl.x86_64 0:1.0.1e-58.el6_10 will be an update
为依赖被安装:
  keyutils-libs-devel.x86_64 0:1.4-5.el6  krb5-devel.x86_64 0:1.10.3-65.el6  libcom_err-devel.x86_64 0:1.41.12-24.el6  libselinux-devel.x86_64 0:2.0.94-7.el6
  libsepol-devel.x86_64 0:2.0.41-4.el6    zlib-devel.x86_64 0:1.2.3-29.el6

更新完毕:
  openssl.x86_64 0:1.0.1e-58.el6_10

完毕!
[root@centos6 linux-4.13.2]# make
  IHEX    firmware/ti_3410.fw
  IHEX    firmware/ti_5052.fw
  IHEX    firmware/mts_cdma.fw
  IHEX    firmware/mts_gsm.fw
  IHEX    firmware/mts_edge.fw
  H16TOFW firmware/edgeport/boot.fw
  H16TOFW firmware/edgeport/boot2.fw
  H16TOFW firmware/edgeport/down.fw
  H16TOFW firmware/edgeport/down2.fw
  IHEX    firmware/edgeport/down3.bin
  IHEX2FW firmware/whiteheat_loader.fw
  IHEX2FW firmware/whiteheat.fw
  IHEX2FW firmware/keyspan_pda/keyspan_pda.fw
  IHEX2FW firmware/keyspan_pda/xircom_pgs.fw
  [root@centos6 linux-4.13.2]# make modules_install
  INSTALL arch/x86/crypto/aes-x86_64.ko
  INSTALL arch/x86/crypto/aesni-intel.ko
  INSTALL arch/x86/crypto/crc32c-intel.ko
  INSTALL arch/x86/crypto/ghash-clmulni-intel.ko
,,,
  INSTALL /lib/firmware/edgeport/down.fw
  INSTALL /lib/firmware/edgeport/down2.fw
  INSTALL /lib/firmware/edgeport/down3.bin
  INSTALL /lib/firmware/whiteheat_loader.fw
  INSTALL /lib/firmware/whiteheat.fw
  INSTALL /lib/firmware/keyspan_pda/keyspan_pda.fw
  INSTALL /lib/firmware/keyspan_pda/xircom_pgs.fw
  DEPMOD  4.13.2
[root@centos6 linux-4.13.2]#  make install
sh ./arch/x86/boot/install.sh 4.13.2 arch/x86/boot/bzImage \
                System.map "/boot"
ERROR: modinfo: could not find module ib_sa
ERROR: modinfo: could not find module ib_mad
ERROR: modinfo: could not find module ib_addr
ERROR: modinfo: could not find module microcode
ERROR: modinfo: could not find module snd_page_alloc
ERROR: modinfo: could not find module crc_t10dif
[root@centos6 linux-4.13.2]# ls /boot
config-2.6.32-754.el6.x86_64  initramfs-2.6.32-754.el6.x86_64.img    symvers-2.6.32-754.el6.x86_64.gz  System.map-4.13.2              vmlinuz-4.13.2
efi                           initramfs-4.13.2.img                   System.map                        vmlinuz
grub                          initrd-2.6.32-754.el6.x86_64kdump.img  System.map-2.6.32-754.el6.x86_64  vmlinuz-2.6.32-754.el6.x86_64
[root@centos6 linux-4.13.2]#
[root@centos6 ~]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,0)
#          kernel /boot/vmlinuz-version ro root=/dev/sda1
#          initrd /boot/initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (4.13.2)
        root (hd0,0)
        kernel /boot/vmlinuz-4.13.2 ro root=UUID=4a87122f-01fc-4cb4-8c05-85664b6478d2 rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
        initrd /boot/initramfs-4.13.2.img
title CentOS 6 (2.6.32-754.el6.x86_64)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-754.el6.x86_64 ro root=UUID=4a87122f-01fc-4cb4-8c05-85664b6478d2 rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=auto LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
        initrd /boot/initramfs-2.6.32-754.el6.x86_64.img
5、至此,内核编译成功,重启验证一下

登录服务器查看内核信息

代码语言:javascript
复制
[root@centos6 /]# uname -a
Linux centos6 4.13.2 #1 SMP Fri Jul 9 02:25:51 CST 2021 x86_64 x86_64 x86_64 GNU/Linux
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、基础环境配置
    • 1、配置yum源(centos6官方已经下架,不在维护,yum源需要配置到备用源)
      • 2、下载gcc相关源码包
        • 3、编译安装gcc组件
          • 4、编译kernel内核
            • 5、至此,内核编译成功,重启验证一下
            领券
            问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档