内核源码下载地址:
https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.4.1.tar.gz
安装依赖包:报错就装
cp /boot/config-xxx ./.config
make mrproper
make menuconfig,然后save保存,退出
make -j4 //四线程编译
sudo make modules_install
执行完这个命令,在/lib/modules目录生成4.4.1名字的目录
lkmao@MiWiFi-R3600-srv:~/netmap/kernel/linux-4.4.1$ ls /lib/modules/
4.4.0-186-generic 4.4.1
lkmao@MiWiFi-R3600-srv:~/netmap/kernel/linux-4.4.1$
sudo make bzImage
lkmao@MiWiFi-R3600-srv:~/netmap/kernel/linux-4.4.1$ ls arch/x86/boot/bzImage -lsh
6.7M -rw-r--r-- 1 root root 6.7M May 3 21:16 arch/x86/boot/bzImage
lkmao@MiWiFi-R3600-srv:~/netmap/kernel/linux-4.4.1$
sudo cp arch/x86/boot/bzImage /boot/vmlinuz-4.4.1
sudo cp .config /boot/config-4.4.1
cd /lib/modules/4.4.1/
sudo update-initramfs -c -k 4.4.1
lkmao@MiWiFi-R3600-srv:/lib/modules/4.4.1$ sudo update-initramfs -c -k 4.4.1
update-initramfs: Generating /boot/initrd.img-4.4.1
lkmao@MiWiFi-R3600-srv:/lib/modules/4.4.1$
sudo update-grub
lkmao@MiWiFi-R3600-srv:/lib/modules/4.4.1$ sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.4.1
Found initrd image: /boot/initrd.img-4.4.1
Found linux image: /boot/vmlinuz-4.4.0-186-generic
Found initrd image: /boot/initrd.img-4.4.0-186-generic
done
lkmao@MiWiFi-R3600-srv:/lib/modules/4.4.1$
重启后查看版本:
lkmao@MiWiFi-R3600-srv:~$ cat /proc/version
Linux version 4.4.1 (root@MiWiFi-R3600-srv) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ) #1 SMP Wed May 3 21:15:50 PDT 2023
lkmao@MiWiFi-R3600-srv:~$
好了,内核更换成功了。