Files
linux-wiki/content/deepin折腾笔记/第五章/5.16.md
2021-10-21 14:57:58 +08:00

14 lines
1.1 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 5.16 自行编译内核
一般只在需要自行调整内核编译参数时,才需要自己编译内核。这是个费时又费力的活。
1. 安装必备工具和依赖:`sudo apt install build-essential fakeroot bisonflex libssl-dev libncurses5-dev`
2. 下载内核源码https://www.kernel.org/ ,选择版本,下载后右键“解压到当前文件夹”。
3. 进入源码所在目录右键“在终端中打开”拷贝旧配置文件cp /boot/config-`uname -r`* .config
4. 基于当前系统内核配置文件生成新内核配置文件:`make olddefconfig`
5. 调整内核编译参数,除非你清楚选项的作用,否则请忽略:`make menuconfig`
6. 多核编译:`make deb-pkg -j $(echo $(nproc)-1|bc)`
7. 编译完成后会在源码的上一级目录中生成deb安装文件`sudo dpkg -i *.deb` 安装即可。
注意:
1. 如果想修改参数再重新编译建议执行”make mrproper“清理一下
2. 上述第四步不建议使用默认配置make defconfig
3. 推荐阅读https://www.jianshu.com/p/9fbdfd919fc0