[Share Experiences] 记录一下linux内核的编译
Tofloor
poster avatar
.(柯南)
deepin
2023-04-16 07:09
Author

https://www.kernel.org/

首先去内核官方下内核包

1、安装需要的软件包
sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc flex libelf-dev bison

2、拷贝启动目录到源代码目录
cp -v /boot/config-$(uname -r) .config

3、配置命令启动配置界面
make menuconfig

4、开始编译
make -j 10 (核心数量)

5、安装模块
sudo make modules_install

6、安装内核
sudo make install

7、查看所有的内核
dpkg --get-selections | grep linux

8、删除不需要的内核
sudo apt-get purge XXX

9、更新引导
sudo update-grub

Reply Favorite View the author
All Replies
jjcui8595
deepin
2023-04-16 14:37
#1

你亲自这样编译过吗?我这样编译的话无法启动,需要在编译模块时加上strip才行

Reply View the author
jiutian123
deepin
2023-04-16 19:37
#2
jjcui8595

你亲自这样编译过吗?我这样编译的话无法启动,需要在编译模块时加上strip才行

strip是什么?以前用uos时编译过 类似楼主的方法confused

Reply View the author
fuuko
deepin
2023-04-16 19:57
#3
jiutian123

strip是什么?以前用uos时编译过 类似楼主的方法confused

去除调试信息和没有用到的符号表

Reply View the author
fuuko
deepin
2023-04-16 19:58
#4

两个问题

  1. 不是所有人的电脑都是10核心的
  2. 第一步应该是先备份数据,不是去下源码
Reply View the author
.(柯南)
deepin
2023-04-17 01:16
#5
jjcui8595

你亲自这样编译过吗?我这样编译的话无法启动,需要在编译模块时加上strip才行

因为deepin的内核和官方内核并不一样,所以根据自己的硬件strip就好了,核心数量根据自己的电脑填就行

Reply View the author
.(柯南)
deepin
2023-04-17 01:17
#6
fuuko

两个问题

  1. 不是所有人的电脑都是10核心的
  2. 第一步应该是先备份数据,不是去下源码

详见我另外的一个帖子 才安装上驱动有问题 所以直接编译内核了

Reply View the author