「学习笔记」Deepin下Linux内核编译
# Linux内核编译
## 下载内核:
https://www.kernel.org
## 安装编译环境
```
sudo apt install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison liblz4-tool
```
## 解压源码到/usr/src:
```
sudo tar -xavf linux-5.18.8.tar -C /usr/src/
```
## 拷贝配置文件到源码目录
```
cd /usr/src/linux-5.18.8/
cp /boot/config-`uname -r` ./.config
```
```
sudo su
make menuconfig
加载配置文件:load-->exit
make -j8
make INSTALL_MOD_STRIP=1 modules_install
reboot
```
## 内核卸载
### 1、系统安装内核
```
dpkg --get-selections | grep linux
```
### 2、卸载自编译安装的内核
删除/boot目录下面目标内核版本相关的配置文件
删除/usr/src目录下的目标旧内核源码
删除/lib/modules目录下目标旧模块
删除/var/lib/initramfs-tools目录下目标旧工具
update-grub 更新grub
## 参考链接:
https://bbs.deepin.org/post/237619
https://www.jianshu.com/p/eece4167999d
https://linux.cn/article-9665-1.html
https://elementaryos.stackexchange.com/questions/25182/elementary-os-is-slow-and-unstable