x86下源码安装内核
-
去 https://www.kernel.org/pub/linux/kernel/ 下载对应的版本源码,eg. linux-6.11.tar.xz
-
安装依赖
apt-get install libssl-dev libncurses5-dev -
编译
make mrproper #清理代码
#使用x86的通用配置:./arch/x86/configs/x86_64_defconfig
make x86_64_defconfig
make menuconfig #SYSTEM_TRUSTED_KEYS, https://blog.csdn.net/m0_47696151/article/details/121574718
make -j4 #这个命令包括了 make bzImage(生成内核) 和 make modules(生成单独编译的内核模块)。完成后内核与模块都已经编译好。此指令会生成生成相应内核版本的内核模块和vmlinuz,Symtem.map文件。
- 安装
sudo make modules_install #指令执行完会在/lib/modules/目录下生成对应版本的内核模块
sudo make install #此指令是把原先make产生的System.map, vmlinux,config,initrd.img文件拷贝到/boot/目录下
- 使用
vim /etc/default/grub,
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
# GRUB_TIMEOUT_STYLE=hidden ==》增加#,mark掉这一行
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5 ==》修改为5秒
修改完成再update-grub