官网链接:https://kernel.org
内核下载库:
https://mirrors.edge.kernel.org/pub/linux/kernel/
root@cary:~# apt-get update
root@cary:~# sudo apt-get install libncurses5-dev build-essential kernel-package flex bison libelf-dev libssl-dev
root@cary:~# tar xzf linux-5.10.134.tar.gz
root@cary:~#
root@cary:~# cd linux-5.10.134/
root@cary:~/linux-5.10.134# ls
arch certs CREDITS Documentation fs init Kbuild kernel LICENSES Makefile net samples security tools virt
block COPYING crypto drivers include ipc Kconfig lib MAINTAINERS mm README scripts sound usr
root@cary:~/linux-5.10.134#
root@cary:~/linux-5.10.134# make menuconfig
HOSTCC scripts/basic/fixdep
UPD scripts/kconfig/mconf-cfg
HOSTCC scripts/kconfig/mconf.o
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/mconf
#
# using defaults found in /boot/config-5.4.0-150-generic
#
/boot/config-5.4.0-150-generic:3815:warning: symbol value 'm' invalid for ISDN_CAPI
/boot/config-5.4.0-150-generic:8240:warning: symbol value 'm' invalid for ASHMEM
/boot/config-5.4.0-150-generic:9200:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
/boot/config-5.4.0-150-generic:9201:warning: symbol value 'm' invalid for ANDROID_BINDERFS
/boot/config-5.4.0-150-generic:9269:warning: symbol value 'm' invalid for INTERCONNECT
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
编译的过程中肯能会报错,根据实际报错解决就好,google搜索一定就行,可以留言一下,因为我很早之去就搭好了编译的环境
make -j8
make modules -j8
报错
make[1]: *** No rule to make target 'debian/canonical-certs.pem', needed by 'certs/x509_certificate_list'. Stop.
修改
vim .config
修改前:
CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"修改后:
CONFIG_SYSTEM_TRUSTED_KEYS=""
root@cary:~# make bzImage
root@cary:~# make modules_install
root@cary:~# sudo make install
1.修改grub
2.当前系统版本
3.更新grub
4.升级后系统版本
通过rpm和deb升级内核,这种方法就更简单了,直接apt和yum下载就ok
apt update
apt search linux-image
apt install linux-image-5.4.0-131
apt install linux-modules-5.4.0-131