liunx 内核升级

查看当前的内核版本

[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64

下载内核

根据图片操作即可

上传软件包,解压软件包

[root@localhost ~]# ls
anaconda-ks.cfg awk linux-3.16.61.tar.xz

解压成tar包

[root@localhost ~]# xz -d linux-3.16.61.tar.xz
[root@localhost ~]# ls
anaconda-ks.cfg awk linux-3.16.61.tar

如果没有 xz 是需要安装的,yum -y install xz 解压过程需要等待几分钟

解压tar包

[root@localhost ~]# tar -xvf linux-3.16.61.tar ^C
[root@localhost ~]# ls
anaconda-ks.cfg awk linux-3.16.61 linux-3.16.61.tar

真正的操作来了

  1. 进入核心目录里
    [root@localhost ~]# cd linux-3.16.61/
    [root@localhost linux-3.16.61]#
  2. 图形化界面
    [root@localhost linux-3.16.61]# make menuconfig
    (图形化页面是为了生成一个.config 的隐藏文件)

编译安装的时候出现了报错信息(图形化工具)

[root@localhost linux-3.16.61]# make menuconfig
HOSTCC scripts/basic/fixdep
/bin/sh: gcc: 未找到命令
make[1]: *** [scripts/basic/fixdep] 错误 127
make: *** [scripts_basic] 错误 2

这些命令都可以用yum 安装,(之前我安装的是阿里云的yum,可以很好的解决这个问题)

[root@localhost linux-3.16.61]# make oldconfig //使用当前版本内核的设置

 HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#

[root@localhost linux-3.16.61]# sh -c ‘yes “” | make oldconfig’ //使用当前内核的配置,新配置,使用默认

scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#

上述步骤执行完成后会生成一个.config文件,即编译内核所需要的配置文件。编辑生成的 .config 文件,将CONFIG_SYSFS_DEPRECATED_V2 改成CONFIG_SYSFS_DEPRECATED_V2=y,否则会出现“Kernel panic – not syncing: Attempted to kill init!”的错误。

2 编译并安装内核

2.1 make // 编译过程大约需一个小时(这 个取决于i的机器)

(这个环节我出了一个小小的错误,说没有bc命令,这个通过yum安装报错命令就可以了)

liunx 的内核是用C语言编写的,所以要需要有支持C语言的环境

2.2 make modules_install install

https://blog.csdn.net/guoxiaojie_415/article/details/50573829

http://blog.51cto.com/it168/1141702
https://www.cnblogs.com/niyeshiyoumo/p/6762193.html

猜你喜欢

转载自blog.csdn.net/weixin_42816196/article/details/84984645