debian7编译内核
第一个步骤“配置内核”。
在这里,我比较建议在发行版默认的config的基础上再进行配置,这样 配置出的内核和发行版本身才会有更好的相容性。比如可以在运行“make menuconfig”之前执行命令“cp /boot/config-2.6.35-24-generic .config”,或者在menuconfig里先把/boot/config-2.6.35-24-generic load进来。
第二个步骤是编译内核并打包的过程。通常我们可以这样下命令:
make-kpkg --initrd --revision wwang.001 --append-to-version -20110107 kernel_image
1、--initrd选项会让make-kpkg自动帮我们生成initramfs;
2、--revision会给生成的deb文件加上一个版本信息。这个参数只是影响到文件名,如果不指定,默认会是“10.00.Custom”;
3、--append-to-version也是一种版本信息,它不仅出现在deb安装包的文件名里,也会影响到kernel的名称,比如本例中,内核更新完成之后,用“uname -r”察看会得到“2.6.36-20110107”;
4、kernel_image表示生成内核和默认模块的安装包,另外您也可以加上kernel_headers,这样make-kpkg会再生成一个内核头文件的安装包。
如果我们用普通用户来执行make-kpkg,需要加上fakeroot运行。
fakeroot make-kpkg --initrd --revision wwang.001 --append-to-version -20110107 kernel_image
编译过程执行完毕之后,会在上层目录里生成一个deb安装包,本例中生成的安装包的文件名是“linux-image-2.6.36-20110107_wwang.001_i386.deb”。
之后我们就可以用dpkg命令或者在文件浏览器中双击安装了,安装完毕之后,直接重启就可以选择进入新的内核。
使用make-kpkg来编译内核,还有其他好处。因为我们是通过包管理器来安装新的内核,当不再需要这个内核时,就可以简单的通过dpkg命令、新立得软件包管理器或者Ubuntu软件中心来完全卸载,而不需要一个个手动删除修改。
手册的编译方法:
http://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-building
4.5 Building a custom kernel from Debian kernel source
This section describes the simplest possible procedure to build a custom kernel the "Debian way". It is assumed that user is somewhat familiar with kernel configuration and build process. If that's not the case, it is recommended to consult the kernel documentation and many excellent online resources dedicated to it.
The easiest way to build a custom kernel (the kernel with the configuration different from the one used in the official packages) from the Debian kernel source is to use the linux-source package and the make deb-pkg target. First, prepare the kernel tree:
# apt-get install linux-source-3.2
$ tar xjf /usr/src/linux-source-3.2.tar.bz2
$ cd linux-source-3.2
The kernel now needs to be configured, that is you have to set the kernel options and select the drivers which are going to be included, either as built-in, or as external modules. The kernel build infrastructure offers a number of targets, which invoke different configuration frontends. For example, one can use console-based menu configuration by invoking the command
$ make menuconfig
Instead of menuconfig one can use config (text-based line-by-line configuration frontend) or xconfig (graphical configuration frontend). It is also possible to reuse your old configuration file by placing it as a .config file in the top-level directory and running one of the configuration targets (if you want to adjust something) or make oldconfig (to keep the same configuration). Note that different frontends may require different additional libraries and utilities to be installed to function properly. For example, the menuconfig frontend requires the ncurses library, which at time of writing is provided by the libncurses5-dev package.
The build will use less disk space if the CONFIG_DEBUG_INFO option is disabled (see Disk space requirements, Section 4.2.1.1). Debuginfo is only needed if you plan to use binary object tools like crash, kgdb, and SystemTap on the kernel.
$ scripts/config --disable DEBUG_INFO
After the configuration process is finished, the new or updated kernel configuration will be stored in .config file in the top-level directory. The build is started using the commands
$ make clean
$ make deb-pkg
As a result of the build, a custom kernel package linux-image-3.2.19_3.2.19-1_i386.deb (name will reflect the version of the kernel and build number) will be created in the directory one level above the top of the tree. It may be installed using dpkg just as any other package:
# dpkg -i ../linux-image-3.2.19_3.2.19-1_i386.deb
This command will unpack the kernel, generate the initrd if necessary (see Managing the initial ramfs (initramfs) archive, Chapter 7 for details), and configure the bootloader to make the newly installed kernel the default one. If this command completed without any problems, you can reboot using the
# shutdown -r now
command to boot the new kernel.
For much more information about bootloaders and their configuration please check their documentation, which can be accessed using the commands man lilo, man lilo.conf, man grub, and so on. You can also look for documentation in the /usr/share/doc/package directories, withpackage being the name of the package involved.
debian7编译内核的更多相关文章
- linux内核学习之二:编译内核
在linux内核学习系列的第一课中讲述了搭建学习环境的过程(http://www.cnblogs.com/xiongyuanxiong/p/3523306.html),环境搭好后,马上就进入到下一环节 ...
- 编译内核实现iptables防火墙layer7应用层过滤 (三)
在前面的两篇文章中我们主要讲解了Linux防火墙iptables的原理及配置规则,想博友们也都知道iptables防火墙是工作在网络层,针对TCP/IP数据包实施过滤和限制,属于典型的包过滤防火墙.以 ...
- Debian 7.6 新编译内核 3.15.6 开机加载黑屏
需要手动加载 fbcon 这个模块,或者编译内核的时候,Framebuffer Console support 编译进内核(后者没测试过).加在模块只要修改/etc/default/grub文件或者/ ...
- archlinux 传统方法编译内核linux kernel 3.3.7
From: http://hi.baidu.com/flashgive/item/eaef6326b5eb73d3a417b662 archlinux中传统方法编译内核 1)下载内核以及补丁并解压: ...
- Linux下编译内核配置选项简介
Code maturity level options代码成熟度选项 Prompt for development and/or incomplete code/drivers 显示尚在开发中或尚未完 ...
- Ubuntu下编译内核
一.下载源代码和编译软件的准备 下载内核源代码:http://www.kernel.org/ 注意,点击2.6.25内核的F版,即完整版. 如果你懒得去网站点联接,运行下列命令: 代码: $cd ~ ...
- Linux编译内核提示'make menuconfig' requires the ncurses libraries错误
原来使用的ubuntu 11.10系统由于误操作,导致系统崩溃,重新安装了ubuntu 11.10: 在编译内核的时候,提示如下错误: dingq@wd-u1110:~/hwsvn/2sw/1prj_ ...
- ubuntu10.04编译内核不显示grub菜单解决
问题描述: ubuntu10.04 内核版本2.6.32.28编译内核之后版本2.6.37.6,系统在编译完内核之后,不显示grub菜单 参考资料: http:// ...
- Debian中编译内核
转载: http://blog.163.com/libo_5/blog/static/156968520101016102051580/ http://hi.baidu.com/wg_wang/ite ...
随机推荐
- 让Apache支持ASP.NET
Apache是目前广泛使用的一种网络服务器程序,不仅在UNIX/LINUX平台上被大量使用,而且在Windows平台上也有许多站点放弃了IIS 而转向Apache..NET是微软推出的功能强大的开发技 ...
- WiFi Test Entity
项目要结了,总结下每次新版本WiFi需要测试的内容 1 IOT1.1 connect target[Connected]; modify wifi pwd to wrong pwd[Au ...
- 【九度OJ】题目1201-二叉排序树
题目 建树过程是递归,"递归的思路不是很复杂",经过题目1078的训练,直接开始编码.提交及修改的过程告诉自己,这是一个错觉,对递归的理解还应该再进一步. 自己的实现 #inclu ...
- CDH5.5.1 安装Spark ON Yarn环境
CDH对我们已经封装了,我们如果需要Spark on Yarn,只需要yum安装几个包就可以了. 前面的文章我有写过如果搭建自己内网的CDH Yum服务器,请参考<CDH 5.5.1 Yum源服 ...
- 关于OpenCV做图像处理内存释放的一些问题
转载:http://blog.sina.com.cn/s/blog_67a7426a0101czyr.html 工程运行,发现内存持续增长,到一定的时候就发生了内存泄漏. 内存泄露的定义 内存泄露是说 ...
- 《Java数据结构与算法》笔记-CH2无序数组
/** * 本章目标: * 1.自制数组类 * 2.有序数组:按关键字升降序排列:二分法查找 * 3.分析有序数组.大O表示法 */ /** * 自制数组类 书中有的地方有错误,本程序以修改 */ c ...
- hello, angular
开始系统学习一下angular!首先是hello world.根据官网给出的例子,我们一下做出下面这个东西: <!DOCTYPE html> <html ng-app> < ...
- UVALive 7278 Game of Cards (sg函数)
Game of Cards 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/G Description Alice and Bob ...
- VIM技巧(1)
VIM技巧(1) 替换 36s/^\(.* = \)entity.\(.*\)$/\1this.GetShowName("\2",\2); 删除空行 %g/^$/d %g/^\s* ...
- BestCoder Round #68 (div.2) geometry(hdu 5605)
geometry Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Su ...