打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
内核编译及问题

编译Linux内核

1.0  www.kernel.com 下载源代码

2.0  将下载的源程序解压到 /usr/src 内

二、下载工具

2.0  下载 build-essential:apt-get install build-essential

2.1  下载 libqt3-header:apt-get install libqt3-header

2.2  下载 gcc:apt-get install gcc

备注:如果不下载,后面的 make xconfig 将提示:没有规则可以创建

三、配置并编译

进入 /usr/src 目录,以下操作都是在该目录下进行:

3.0  make xconfig 配置 linux 内核信息,如果需要在嵌入式中装 linux 这点很重要。

详见:http://lamp.linux.gov.cn/Linux/kernel_options.html 讲解了内核配置

3.1  make clean (当源被重新编译需要执行)

3.2  make

3.3 make modules_install

3.4 cp /arch/i386/boot/bzImage /boot/vmlinuz-<version>

3.5  cp System.map /boot/System.map

3.6   mkinitramfs -o /boot/initrd.img-<version> <version>

3.7 修改 /boot/grub/grub.cfg

Reboot 

 

四、遇到问题

4.0  No rule to make target `xxx‘.没有规则可以创建目标** ”解释为:

This means that make decided it needed to build a target, but then couldn’t find any instructions in the makefile on how to do that, either explicit or implicit (including in the default rules database).

If you want that file to be built, you will need to add a rule to your makefile describing how that target can be built. Other possible sources of this problem are typos in the makefile (if that filename is wrong) or a corrupted source tree (if that file is not supposed to be built, but rather only a prerequisite).

4.1  bzImage (中间 I 是大写的 i,不是小写的 L)很多人都写错了

4.2 如果发现自己的 /boot/grub 内没有 menu.lst ,修改 grub.conf 也是一样的

4.3  重启后遇到“Could not load /lib/modules/2.6.39.4/modules.dep ”但实际进去看后,该文件存在,这是因为 initrd.img-<version> 没有生成好,删除原来的文件 initrd.img-<version>update-initrdramfs –c –k 2.6.39.4 重新生成

4.4  中间make xconfig提示没有规则创建 xconfig这是因为 libqt3-header 没有安装,需要先更新源文件服务器,apt-get update 更新源文件,再下载即可

4.5 mkinitrd 是 RedHat 独有的,在编译其他内核时,应该采用 mkinitramfs命令

五、参考

5.0 http://www.sudu.cn/info/html/edu/20080428/302845.html  内容不错,就是内核老了点

5.1  http://www.linuxforums.org/forum/kernel/55612-mini-howto-compile-linux-kernel-2-6-a.html 这里讲的更详细一些,并且给出了最小配置

5.2  http://www.linuxsir.org/bbs/showthread.php?t=363346 

       http://helloyesyes.iteye.com/blog/1084899 这两个都是 debian 内核编译方法

5.3  http://skpsun.blog.163.com/blog/static/276005520091455245426/

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
U-Boot 之四 构建过程(Kconfig 配置 + Kbuild 编译)详解
make和makefile入门zz :: SkyBlue
用makefile来管理工程
怎样编写Makefile文件 - Moose W. Oler的日志 - 网易博客
《Linux内核Makefile分析》之The Linux Kernel Makefile
make, the GNU Recompiling Tool
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服