免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8441 | 回复: 4
打印 上一主题 下一主题

[开发环境] 讨论:vmlinux.bin、bzImage、zImage的区别 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-06-12 16:09 |只看该作者 |倒序浏览
据我所了解:

vmlinux.bin由vmlinux经gzip压缩后,与压缩函数、启动代码一起链接而成

bzImage由vmlinux.bin与setup.bin等文件build而成

zImage是小于640K的压缩核,不知与bzImage是否有其他区别?

我在两个嵌入式项目中发现一些疑问:
1、基于arm平台时编译内核用的是zImage
2、基于misps平台编译内核用的是vmlinux.bin,该平台好像不支持bzImage
3、我在x86的PC上测试,make后生成了vmlinux.bin、setup.bin、bzImage

请教:1中的zImage与3中的bzImage有何区别,是不是嵌入式中一般不用bzImage呢?那bzImage的存在意义何在?
         另外,2中的vmlinux.bin与3中的vmlinux.bin实质一样吗?

请大家发表一下自己的见解

论坛徽章:
0
2 [报告]
发表于 2012-06-13 14:15 |只看该作者
本帖最后由 daniel_kohler 于 2012-06-13 14:16 编辑

回复 1# surf_081


vmlinux

This is the Linux kernel in an statically linked executable file format. Generally, you don't have to worry about this file, it's just a intermediate step in the boot procedure.

The raw vmlinux file may be useful for debugging purposes.

vmlinux.bin

The same as vmlinux, but in a binary file format.

vmlinuz

The vmlinux file usually gets compressed with zlib. Since 2.6.30 LZMA and bzip2 are also available. By adding further boot and decompression capabilities to vmlinuz, the image can be used to boot a system with the vmlinux kernel. The compression of vmlinux can occur with zImage or bzImage.

The function decompress_kernel() handles the decompression of vmlinuz at bootup, a message indicates this:

Decompressing Linux... done
Booting the kernel.

zImage (make zImage)

This is the old format for small kernels (compressed, below 512KB). At boot, this image gets loaded low in memory (the first 640KB of the RAM).

bzImage (make bzImage)

The big zImage (this has nothing to do with bzip2), was created while the kernel grew and handles bigger images (compressed, over 512KB). The image gets loaded high in memory (above 1MB RAM). As today's kernels are way over 512KB, this is usually the preferred way.

论坛徽章:
8
羊年新春福章
日期:2015-03-19 02:03:312015亚冠之北京国安
日期:2015-06-16 22:04:45程序设计版块每日发帖之星
日期:2015-06-23 22:20:00每日论坛发贴之星
日期:2015-06-23 22:20:002015亚冠之首尔
日期:2015-06-24 19:18:072015亚冠之广州恒大
日期:2015-08-06 10:29:442015亚冠之柏太阳神
日期:2015-11-02 11:21:0515-16赛季CBA联赛之辽宁
日期:2015-12-09 15:05:02
3 [报告]
发表于 2013-02-19 18:13 |只看该作者
楼上的出处是哪里?
vmlinux的解释,不能理解。求赐教!


回复 2# daniel_kohler


   

论坛徽章:
0
4 [报告]
发表于 2013-02-20 20:00 |只看该作者

论坛徽章:
0
5 [报告]
发表于 2013-02-26 14:15 |只看该作者
vmlinux 是kernel中object文件link后的文件,注意是个ELF文件。
vmlinux.bin 看生成这个文件的命令,如果是objcopy生成的bin文件则这个文件就是vmlinux这个ELF文件的内存影像。也就说把这个文件载入到硬件系统的某个地址,它就可以启动了。(这个地址一般是它的链接地址)
zImage个bzImage都是把vmlinux.bin压缩后,再加上一个头,这个头负责解压缩vmlinux.bin文件。这与这个头怎么写,那就要和bootloader配合了,因为涉及到bootloader怎么传递命令行参数之类的。一般uboot会有一个工具mkimge之类的直接生成zImage或者uImage。bzimage就简单了,看看kernel的x86 boot的文档,载入这个bzimage后还得在制定的地方填入许多信息,比如命令行参数initrd的地址等等。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP