0
点赞
收藏
分享

微信扫一扫

linux kernel内核版本升级

文风起武 2022-04-30 阅读 191

安装centos

http://vault.centos.org/7.5.1804/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso

此处使用的是1804的版本

[root@localhost ~]# uname -r

3.10.0-862.el7.x86_64

准备环境

yum groupinstall "Development Tools"

yum install bc ncurses-devel elfutils-libelf-devel openssl-devel.x86_64 -y

kernel 4.19.23下载及修改

wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.19.23.tar.gz

解压linux-4.19.23.tar.gz,内核源码一般放在/usr/src/kernels/

tar -xvf linux-4.19.23.tar.gz /usr/src/kernels/

include/net/sock.h  

struct sock 结构体增加如下变量:

__be32                  sk_toa_data[8];

拷贝使用当前系统的配置文件

# cd linux-4.19.23

# cp /boot/config-'uname -r' .config

通过菜单方式配置内核

make menuconfig

编译并安装内核

make clean                #清除下内核编译的目标文件

make bzImage -j4      #生成内核文件,制作压缩后的内核文件

上一步执行完,内核文件在/usr/src/kernels/linux-4.19.23/arch/x86_64/boot/bzImage里面。

CC net/ipv4/tcp_input.o

...

make modules -j4       #编码模块

LD [M]  sound/soundcore.ko

make modules_install   #安装模块

INSTALL sound/soundcore.ko

上一步执行完,在ll /lib/moudules/4.19.23下面就会有新的内核模块了

make install            #安装

安装完后,在/boot下就会生成

-rw-------. 1 root root 53198420 Apr 29 01:08 initramfs-4.19.23.img

-rwxr-xr-x. 1 root root  6224704 Apr 20  2018 vmlinuz-3.10.0-862.el7.x86_64

编辑开机选单grub

[root@localhost boot]# grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-4.19.23

Found initrd image: /boot/initramfs-4.19.23.img

Found linux image: /boot/vmlinuz-3.10.0-862.el7.x86_64

Found initrd image: /boot/initramfs-3.10.0-862.el7.x86_64.img

Found linux image: /boot/vmlinuz-0-rescue-2d374135dd8249e28cd53510b838c300

Found initrd image: /boot/initramfs-0-rescue-2d374135dd8249e28cd53510b838c300.im

重启测试

选择kernel 4.19.23的内核即可。

举报

相关推荐

0 条评论