ARM Linux Atags vs Device Tree

11,269

Solution 1

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.

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.

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

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.

Solution 2

Basically ATAGs were used to send information to linux kernel about the machine specific information of the board like memory, console information, etc. and these ATAGs were used by linux kernel to initialize the MMU and other subsystem.

But with the advent of device tree (more of using it with arm because it was already getting used in powerpc architecture.) now all the machine related information can be passed using FDT (device tree blob).

There were some ideas floating around for sending device tree information to the kernel using a new atag "atag_dtd" but later there was debate for not using ATAG at all because there was no need to use two seprate method to do a single thing. So now kernel expect a bootloader to provide following information.

r0 = 0
r1 = Same type of SOC fdt machine id.
r2 = physical address where the dtd can be found.

It uses same structure which were used by bootloader to send atag information so it could be backword compatible.

Hope it helps.

Share:
11,269

Related videos on Youtube

Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    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?

  • paxdiablo
    paxdiablo over 5 years
    How does one pass arbitrary command line parameters to the kernel (i.e., nothing to do with the hardware environment)? Or is this not possible?
  • tangrs
    tangrs over 5 years
    @paxdiablo I believe the kernel command line parameters are passed through ATAGs or the device tree block.