Mou*_*uin 6 linux boot kernel u-boot
我正在尝试了解 zImage 和 uImage 之间的区别。
在我的理解中,它uImage是通过运行mkimage获得的Image,因此它添加了一个 U-Boot 包装器(我不知道它究竟包含什么),其中包含一个标头以及加载地址和入口点,可能还有我的“额外信息”不知道。
另一方面,它zImage是压缩的Image,它不包含加载地址和入口点(我认为,如果我错了,请纠正我),但 U-Boot 也可以使用bootz.
在这种情况下,为什么使用 auImage而不是 a zImage?
我很想知道 zImage 和 uImage 的格式是什么,你能推荐一些参考吗?
在我的理解 uImage 是通过在 Image 上运行 mkimage 获得的
你的理解只是部分正确。
甲的uImage可以包含任何类型的文件,并且不限制在Linux的图像文件。事实上,它不太可能是(未压缩的)图像文件(因为这不是传统的make选项)。
另一方面,zImage 是压缩图像,它不包含加载地址和入口点(我认为,如果我 [原文如此] 错误,请纠正我)
你错了,zImage确实包含内核的加载地址和入口点。为了将内核映像解压缩到正确的 RAM 地址,需要加载地址。解压后需要内核的入口点来执行它。
在为 ARM 构建 Image 和 zImage 时,Makefiles 使用
ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
Run Code Online (Sandbox Code Playgroud)
这应该转换为物理内存的开始 + 0x8000。
zImage 本身(即自解压程序)是PIC,位置无关代码。zImage 可以加载到 RAM 中的任何位置,并在它的第一个地址执行,即它的入口点是它的加载地址。
在这种情况下,为什么使用 uImage 而不是 zImage?
对于旧版本的 U-Boot,别无选择,因为bootz命令可能不适用于 Linux 内核。
如今,这可能是一种主观选择。
请注意,Linux 内核社区对内核中对 U-Boot 的支持存在一些不满。IOW 如果有人按照自己的方式行事,我的印象是您将无法从主线源构建uImage。
我很想知道 zImage 和 uImage 的格式是什么,你能推荐一些参考吗?
zImage 的布局基本上由其链接器规范给出。
对于 ARM,请参阅arch/arm/boot/compressed/vmlinux.lds.S。
请注意,_magic_start包含一个无意义的加载地址。这在 Vincent Sanders 的Booting ARM Linux 的第 5 节中也有提到
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.
Run Code Online (Sandbox Code Playgroud)
但请注意,ARM 启动要求已被 Russel King 的文档/arm/Booting取代
uImage 的布局只是 U-Boot 标头加上图像文件,无论是什么。
(希望我写的没有与 Tom Rini 写的相矛盾。)
| 归档时间: |
|
| 查看次数: |
4366 次 |
| 最近记录: |