
1. 配置编译环境
代码: 全选
apt-get install fakeroot build-essential
apt-get install crash kexec-tools makedumpfile kernel-wedge
apt-get build-dep linux-image-$(uname -r)
apt-get install git libncurses5 libncurses5-dev libnewt-dev
有3种选择: 用git到kernel.ubuntu.com下载源代码。(我这里太慢了,忽略这个方法)
到www.kernel.org下载源代码。(用Debian的方式编译,见论坛顶置帖子)
在终端中使用如下命令下载当前内核的源代码。(下载源代码包,自动解压缩到当前目录并打上补丁。推荐)
代码: 全选
apt-get source linux-image-$(uname -r)
3. Patch
如果需要打补丁,把补丁文件解压缩到源代码所在目录,然后
代码: 全选
patch -p1 < patch.diff

如果是使用apt-get下载源代码,就不需要打补丁了。已经自动打上了。
4. 配置内核,准备脚本,编译,安装。(Ubuntu方式)
我折腾内核无非就是想精简掉不用的内核模块,改一些优化参数,具体可以参见论坛的顶置帖子,不再熬述。
修复脚本权限:
代码: 全选
chmod -R a+x debian/scripts
chmod -R a+x debian/control-scripts
chmod -R a+x debian/tools
chmod a+x debian/tests/check-aliases
chmod a+x debian/rules
代码: 全选
fakeroot debian/rules clean
fakeroot debian/rules updateconfigs
fakeroot debian/rules editconfigs
代码: 全选
fakeroot debian/rules clean
fakeroot debian/rules binary-headers binary-generic
代码: 全选
sudo dpkg -i linux-header-*_all.deb linux-header-*_amd64.deb linux-image-*.deb
http://forum.ubuntu.org.cn/viewtopic.php?f=77&t=359723
官方教程:
https://help.ubuntu.com/community/Kernel/Compile
https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
https://wiki.ubuntu.com/KernelTeam/GitKernelBuild