1. 在https://kernel.ubuntu.com/mainline/ 上下载目标内核的文件,安装之后,在/boot目录下拿到cfg文件
2.从The Linux Kernel Archives 上下载内核代码
3. 把cfg文件拷贝到内核代码的目录下
4.安装tool
sudo apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev
5. 执行如下代码
scripts/config --disable SYSTEM_TRUSTED_KEYS
$ scripts/config --disable SYSTEM_REVOCATION_KEYS
$ scripts/config --set-str CONFIG_SYSTEM_TRUSTED_KEYS ""
$ scripts/config --set-str CONFIG_SYSTEM_REVOCATION_KEYS ""
6. make -j N 编译内核
7. make modules_install
8.make install
9.update-grub
10.修改grub文件/etc/default/grub
GRUB_TERMINAL=console
GRUB_TIMEOUT=5
其他:
1. 开机不加载驱动
GRUB_CMDLINE_LINUX="modprobe.blacklist=cxl_core,cxl_port"
2. reserve memory
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset efi=nosoftreserve memmap=102400G\\\$34G"
3. linux source code online
Linux source code (v6.10) - Bootlin