本文介绍了ARM Linux 标签与设备树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设备树和 ATAG 有什么区别?此外,ATAG 是必须的吗?内核是否希望它们位于固定地址,还是希望它们位于 r0-r3 中?

What is the difference between device tree and ATAGs? Also, are ATAGs a must and does the kernel expect them at a fixed address, or does it expect them in r0-r3?

推荐答案

设备树描述了内核用于选择加载哪些驱动程序、所有 MMIO 接口所在位置等硬件的所有信息……在运行时.ATAG 只是描述了诸如在哪里可以找到 initrd 和内核参数、内存等之类的东西...... - 关于机器的其他一切都被硬编码到内核中.

A device tree describes everything about the hardware which the kernel uses to select which drivers to load, where all the MMIO interfaces are, etc... at runtime. ATAGs just describes stuff like where to find an initrd and kernel parameters, memory, etc... - everything else about the machine is hard coded into the kernel.

现在的首选方法是使用设备树而不是 ATAG.优势之一包括添加新平台并不总是需要向内核添加新代码.

The preferred method now is to use device trees instead of ATAGs. One of the advantages include the fact that adding a new platform doesn't always require adding new code to the kernel.

回答您的第二个问题,如果您已阅读在 ARM 平台上启动 Linux 的文档,您会发现内核希望在将控制权移交给内核之前将以下内容放入寄存器中:

To answer your second question, if you had read the documentation for booting Linux on the ARM platform, you'd find that the kernel expects the following to be placed in the registers before control is handed over to the kernel:

r0 = 0,
r1 = machine type number discovered in (3) above.
r2 = physical address of tagged list in system RAM, or
     physical address of device tree block (dtb) in system RAM

我相信有(或至少有)从固定位置加载 ATAG 的选项,而不是在 r2 中找到的地址.但是,ATAG 的使用现在已被弃用和过时,新平台不应使用它.

I believe there is (or at least was) an option to load ATAGs from a fixed location instead of the address found in r2. However, the use of ATAGs is now being deprecated and obsolete and new platforms shouldn't be using it.

这篇关于ARM Linux 标签与设备树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 14:21