使用 LOADADDR 构建内核 uImage [英] Building kernel uImage using LOADADDR

查看:18
本文介绍了使用 LOADADDR 构建内核 uImage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在构建内核时,我将 LOADADDR 指定为0x80008000":

While building the kernel I am giving LOADADDR as "0x80008000":

make uImage LOADADDR=0x80008000

你能帮忙理解一下这个有什么用吗?LOADADDR可以改吗,LOADADDR的长度有限制吗?

Can you please help to understand what is the use of this? Can I change the LOADADDR, is there any restriction on the length of the LOADADDR?

推荐答案

(根据 U-Boot 的提及和 LOADADDR 的值,我假设您正在使用 ARM.)

(I'm assuming that you're using ARM based on the mention of U-Boot and the value of LOADADDR.)

你能帮忙理解一下这个有什么用吗?

Can you please help to understand what is the use of this?

LOADADDR 指定链接器将定位内核映像的地址.(这适用于一些架构(例如 Blackfin),但不适用于 ARM.

LOADADDR specifies the address where the kernel image will be located by the linker. (This is true for a few architectures (e.g. Blackfin), but not for ARM.

LOADADDR 指定内核映像将被 U-Boot 定位的地址,并由 mkimage 实用程序存储在 U-Boot 标头中.通常加载地址(用于放置在内存中)也是起始地址(用于执行).请注意,uImage 文件通常只是带有 U-Boot 包装器的(自解压、压缩)zImage 文件.

LOADADDR specifies the address where the kernel image will be located by U-Boot and is stored in the U-Boot header by the mkimage utility. Typically the load address (for placement in memory) is also the start address (for execution). Note that the uImage file is typically just the (self-extracting, compressed) zImage file with the U-Boot wrapper.

我可以更改 LOADADDR 吗,

Can I change the LOADADDR,

是的,但根据 (Vincent Sanders') 启动 ARM Linux 这将违反 ARM 约定:

Yes, but according to (Vincent Sanders') Booting ARM Linux that would be contrary to ARM convention:

  • 尽管能够将 zImage 放置在内存中的任何位置,约定它是在物理 RAM 的基础上加载的,加上0x8000 (32K) 的偏移量.这为参数块留下了空间通常放置在偏移量 0x100、零页异常向量和页表.这种约定很常见.
  • Despite the ability to place zImage anywhere within memory, convention has it that it is loaded at the base of physical RAM plus an offset of 0x8000 (32K). This leaves space for the parameter block usually placed at offset 0x100, zero page exception vectors and page tables. This convention is very common.

(您问题中提到的 uImage 可能只是带有 U-Boot 包装器的 zImage,因此引用确实适用.)

(The uImage mentioned in your question is probably just a zImage with the U-Boot wrapper, so the quotation does apply.)

LOADADDR 的长度有限制吗?

is there any restriction on the length of the LOADADDR?

长度"?如果您使用的是 32 位处理器,则此地址的长度将为 32 位.

The "length"? If you're using a 32-bit processor, then the length of this address would be 32 bits.

附录

arch/arm/boot/Makefile 仅使用 LOADADDR 从 zImage 构建 uImage.

arch/arm/boot/Makefile only uses LOADADDR for building the uImage from the zImage.

来自 (Russel King's) 启动 ARM Linux 对此 LOADADDR 的限制是:

From (Russel King's) Booting ARM Linux the constraints on this LOADADDR are:

该内核应该放在 RAM 的前 128MiB 中.推荐它加载到 32MiB 以上以避免需要重新定位在解压之前,这将使启动过程略更快.

The kernel should be placed in the first 128MiB of RAM. It is recommended that it is loaded above 32MiB in order to avoid the need to relocate prior to decompression, which will make the boot process slightly faster.

启动原始(非 zImage)内核时,约束会更严格.在这种情况下,内核必须以偏移量加载到系统中,等于到 TEXT_OFFSET - PAGE_OFFSET.

When booting a raw (non-zImage) kernel the constraints are tighter. In this case the kernel must be loaded at an offset into system equal to TEXT_OFFSET - PAGE_OFFSET.

设备树或 ATAG 或 initramfs 的预期位置可以在此 LOADADDR 上添加更多约束.

The expected locations for the Device Tree or ATAGs or an initramfs can add more constraints on this LOADADDR.

这篇关于使用 LOADADDR 构建内核 uImage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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