-
从现有系统的
/boot
目录下找到带有config
字样的配置文件 -
因为openkylin自带docker,所以这里使用容器编译
-
openkylin实际上是Ubuntu focal 所以选择ubuntu:focal作为容器系统 同理 deepin、uos实际上是debian buster
-
下载你想要安装的内核版本
-
把上述这些东西所在的文件夹直接挂载给容器
-
解包
linux-x.x.x
-
把准备好的配置文件放到文件夹里并重命名为
.config
-
安装编译所需的全部依赖
# 首先把apt源文件中的deb-src注释全部打开
apt update
apt install -y libncurses-dev pkg-config wget git xz-utils make gcc flex bison dpkg-dev bc rsync kmod cpio libssl-dev
apt build-dep -y linux
- 将当前linux文件夹设置为代码仓库
git init
git add .
git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"
git commit -m "1"
- 开始编译
make olddefconfig
scripts/config --disable DEBUG_INFO
scripts/config --enable MODULE_COMPRESS
make CCACHE_DISABLE=1 deb-pkg -j8
- 导出编译产物
和linux-x.x.x
同级目录下的deb包就是目标产物
导出到实体机安装
主要安装
linux-headers*
linux-image
(不带有dbg字样)
两个包即可
- 安装
将deb包移动到实体机的/tmp
目录下
执行
sudo apt install -d /tmp/*.deb
完成