内核介绍
官网链接: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#
生成.config
root@cary:~/linux-5.10.134# make menuconfigHOSTCC scripts/basic/fixdepUPD scripts/kconfig/mconf-cfgHOSTCC scripts/kconfig/mconf.oHOSTCC scripts/kconfig/lxdialog/checklist.oHOSTCC scripts/kconfig/lxdialog/inputbox.oHOSTCC scripts/kconfig/lxdialog/menubox.oHOSTCC scripts/kconfig/lxdialog/textbox.oHOSTCC scripts/kconfig/lxdialog/util.oHOSTCC scripts/kconfig/lxdialog/yesno.oHOSTCC scripts/kconfig/confdata.oHOSTCC scripts/kconfig/expr.oLEX scripts/kconfig/lexer.lex.cYACC scripts/kconfig/parser.tab.[ch]HOSTCC scripts/kconfig/lexer.lex.oHOSTCC scripts/kconfig/parser.tab.oHOSTCC scripts/kconfig/preprocess.oHOSTCC scripts/kconfig/symbol.oHOSTCC scripts/kconfig/util.oHOSTLD 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升级内核
通过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