为什么要使用uImage而不是zImage [英] Why using a uImage instead of a zImage

查看:90
本文介绍了为什么要使用uImage而不是zImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解zImage和uImage之间的区别.

I'am trying to learn the difference between a zImage and a uImage.

据我了解,uImage是通过在Image上运行mkimage来获得的,因此,它添加了一个包含标题加上加载地址和入口点,也许还有其他信息"我不知道.

In my understanding uImage is got by running mkimage on the Image and as a result it adds a U-Boot wrapper (i don't know what it contains exactly) that contains a header plus the load address and entry point and maybe "extra informations" that i don't know.

另一方面,zImage是压缩的Image,它不包含加载地址和入口点(我认为,如果我错了,请纠正我),但U-Boot也可以加载它使用bootz.

In the other hand the zImage is the compressed Image, it doesn't contain the load address and entry point(what i think, correct me if i'am wrong) but also U-Boot can load it using bootz.

  • 在这种情况下,为什么使用uImage而不是zImage?

我很好奇要了解zImage和uImage的格式是什么,您能建议一些参考吗?

I'am curious to learn what are the formats of a zImage and a uImage could you please suggest some references ?

推荐答案

据我所知,uImage是通过在Image上运行mkimage来获得的

In my understanding uImage is got by running mkimage on the Image

您的理解只是部分正确.
uImage 可以包含任何类型的文件,并且不限于Linux Image 文件.实际上,它不可能是(未压缩的)图像文件(因为这不是常规的 make 选项).

Your understanding is only partly correct.
A uImage can contain any type of file, and is not restricted to the Linux Image file. In fact it not likely to be the (uncompressed) Image file (since that is not a conventional make option).

另一方面,zImage是压缩的图像,它不包含加载地址和入口点(我认为,如果我错了,请纠正我)

In the other hand the zImage is the compressed Image, it doesn't contain the load address and entry point(what i think, correct me if i'am [sic] wrong)

您不正确, zImage 确实包含内核的加载地址和入口点.需要加载地址才能将内核映像解压缩到正确的RAM地址.解压缩后,需要内核的入口点来执行它.
为ARM构建Image和zImage时,Makefile使用

You're incorrect, the zImage does contain the kernel's load address and entry point. The load address is needed in order to decompress the kernel Image to the proper RAM address. The kernel's entry point is needed to execute it after it has been decompressed.
When building the Image and zImage for ARM, the Makefiles use

ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)

,应转换为物理内存的开头+ 0x8000.

which should translate to the start of physical memory + 0x8000.

zImage本身(即自解压程序)是PIC,与位置无关的代码. zImage可以加载到RAM中的任何位置,并在其第一个地址处执行,即其入口点是其加载地址.

The zImage itself (i.e. the self-extraction program) is PIC, position independent code. The zImage can be loaded anywhere in RAM, and executed at its first address, i.e. its entry point is its load address.

在这种情况下,为什么要使用uImage而不是zImage?

In this case why using a uImage instead of a zImage?

对于较早版本的U-Boot,由于 bootz 命令可能不适用于Linux内核,因此别无选择.
如今,这可能是一个主观的选择.

For older versions of U-Boot, there was no choice since the bootz command may not have been available for Linux kernels.
Nowadays it may be a subjective choice.

请注意,Linux内核社区对内核中的U-Boot支持有些不满. IOW,如果有人这样做,我会觉得您将无法从主线源构建 uImage .

Note that there has been some resentment in the Linux kernel community towards the support of U-Boot in the kernel. IOW if some people had their way, I get the impression that you would not be able to build a uImage from the mainline source.

我很想知道zImage和uImage的格式是什么,请问您可以提供一些参考吗?

I'am [sic] curious to learn what are the formats of a zImage and a uImage could you please suggest some references ?

zImage的布局基本上由其链接器规范给出.
对于ARM,请参阅 arch/arm /boot/compressed/vmlinux.lds.S .
请注意, _magic_start 包含无意义的加载地址.文森特·桑德斯(Vincent Sanders)的启动ARM Linux 的第5部分也对此进行了提及. a>

The layout of the zImage is essentially given by its linker specification.
For ARM see arch/arm/boot/compressed/vmlinux.lds.S.
Note that _magic_start contains a meaningless load address. This is also mentioned in Section 5 of Vincent Sanders' Booting ARM Linux

The zImage has a magic number and some useful information near its beginning.

Table 2. Useful fields in zImage head code
Offset into zImage  Value       Description
    0x24        0x016F2818      Magic number used to identify this is an ARM Linux zImage
    0x28        start address   The address the zImage starts at
    0x2C        end address     The address the zImage ends at

The start and end offsets can be used to determine the length of the compressed image (size = end - start).  
 ...  
The start address is usually 0 as the zImage code is position independent.

但是请注意,ARM引导要求已由Russel King的

Note however that the ARM booting requirements have been superseded by Russel King's Documentation/arm/Booting

uImage的布局只是U-Boot标头加上图像文件,无论可能是什么.

The layout of a uImage is simply the U-Boot header plus the image file, whatever that may be.

(希望我写的东西与汤姆·里尼(Tom Rini)写的东西矛盾.)

(Hopefully nothing I wrote contradicts what Tom Rini wrote.)

这篇关于为什么要使用uImage而不是zImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆