Contents[hide]
|
The Flattened Device Tree (FDT) is a data structure for describing the hardware in a system. It is a derived from the device tree format used by Open Firmware to encapsulate platform information and convey it to the- operating system. The operating system uses the FDT data to find and register the devices in the system.
Currently the Linux kernel can read device tree information in the x86, Microblaze, PowerPC, and Sparc architectures. There is interest in extending support for device trees to other platforms, to unify the handling of platform description across kernel architectures.
The Flattened Device Tree (FDT) is a data structure. Nothing more.
It describes a machine hardware configuration. It is derived from the device tree format used by Open Firmware. The format is expressive and able to describe most board design aspects including:
Just like initrd images, an FDT image can either be statically linked into the kernel or passed to the kernel at boot time.
Some platforms use board-specific C data structures for passing data from the bootloader to the kernel. Notable here is embedded PowerPC support before standardizing on the FDT data format.
Experience with PowerPC demonstrated that using a custom C data structure is certainly an expedient solution for small amounts of data, but it causes maintainability issues in the long term and it doesn't make any attempt to solve the problem of describing the board configuration as a whole. Special cases tend to grow and there is no way for the kernel to determine what specific version of the data structure is passed to it. PowerPCs board info structure ended up being a mess of #ifdefs and ugly hacks, and it still only passed a handful of data like memory size and Ethernet MAC addresses.
ATAGs have the elegance of providing an well defined namespace for passing individual data items (memory regions, initrd address, etc) and the operating system can reliably decode them. However, only a dozen or so ATAGs are defined and is not expressive enough to describe the board design. Using ATAGs essentially requires a separate machine number to be allocated for each board variant, even if they are based on the same design.
That being said, an ATAG is an ideal method for passing an FDT image to the kernel in the same way an ATAG is used to pass the initrd address.
Firmware providing the Advanced Configuration and Power Interface exports a hardware description in the form of the Differentiated System Description Table (DSDT). ACPI is found on x86 compatible systems and has its roots in the original IBM PC BIOS.
The Extensible Firmware Interface is an interface specification for passing control from a platforms firmware to the operating system. It was designed by Intel as a replacement for the PC BIOS interface.
ARM holdings is a member of the United EFI Forum. It is conceivable that there will be an ARM implementation of UEFI.
Open Firmware is a firmware interface specification designed by Sun in the late 1980's, and ported to many architectures. It specifies a runtime OS client interface, an cross platform device interface (FCode), a user interface, and the Device Tree layout for describing the machine.
FDT is to Open Firmware what DSDT is to ACPI. The FDT reuses Open Firmware's established device tree layout. In fact, Linux PowerPC support uses the same codebase to support both Open Firmware and FDT platforms.
Most of the competing solutions listed above provided feature rich firmware interfaces including both machine description and runtime services. Conversely, the FDT is only a data structure and doesn't specify any firmware interface details. Board ports using the FDT are typically booted from simple firmware implementations like U-Boot and don't provide any form of runtime services.
A common design goal of the feature rich firmware interfaces is to provide an abstract boot interface that factors away the differences between different hardware platforms, at least enough for the OS to initialize its own native device drivers. The idea is to be able to boot 'old' OS images on 'new' hardware, like how a Linux LiveCD image doesn't have explicit knowledge of the hardware configuration, but relies on the information provided to it by firmware.
Typical design goals for embedded firmware is to a) boot the OS as quickly as possible, b) upgrade the OS image, and maybe c) provide some low level debug support during initial board bringup. Focus tends to shift away from firmware once the OS is bootable since the kernel drivers the hardware directly (doesn't depend on firmware runtime services). In fact, firmware updates are discouraged due to the risk of rendering a board unbootable. ACPI, UEFI and OpenFirmware solutions, while arguably 'better', often don't boot as fast, and are more complex than required by the embedded system. In this regard the FDT approach has the advantage due to its simplicity. ie. the FDT provides an equivalently expressive way to describe hardware, but it works with existing firmware and can be updated without reflashing firmware.
There is documentation describing device tree support (with information current as of 2006) in the Linux kernel source tree at: Documentation/powerpc/booting-without-of.txt
"Using the Device Tree to Describe Embedded Hardware" - Grant Likely, Embedded Linux Conference, 2008 http://www.celinux.org/elc08_presentations/glikely--device-tree.pdf
"A Symphony of Flavours: Using the device tree to describe embedded hardware" - Grant Likely and Josh Boyer - paper for OLS 2008 http://ols.fedoraproject.org/OLS/Reprints-2008/likely2-reprint.pdf
Note from Device Tree Birds of a Feature session at OLS 2008: http://lists.ozlabs.org/pipermail/devicetree-discuss/2008-July/000004.html
Links to the Open Firmware device tree bindings and recommended practices which also apply to the FDT: http://www.openfirmware.info/Bindings
A view from outside from the FreeBSD ARM community: http://wiki.freebsd.org/FreeBSDArmBoards
Grant's talk at Plumber's conference 2009 - http://linuxplumbersconf.org/ocw/proposals/47
"The device tree generator is a Xilinx EDK tool that plugs into the Automatic BSP Generation features of the tool, XPS"
https://lists.ozlabs.org/listinfo/devicetree-discuss
Recent discussion of "Flattened Device Tree" work on linux-embedded mailing list: http://www.mail-archive.com/[email protected]/msg01721.html
Russel King is against adding support for FDT to the ARM platform: http://lkml.indiana.edu/hypermail/linux/kernel/0905.3/01942.html (see whole thread for interesting discussion)
But maybe Russel can be convinced: http://lkml.indiana.edu/hypermail/linux/kernel/0905.3/03618.html
David Gibson defends FDT: http://lkml.indiana.edu/hypermail/linux/kernel/0905.3/02304.html