Flattened Device Tree

The mandate of the Flattened Device Tree custodian repository is to improve fdt "blob" support in u-boot. It does this by adapting David Gibson's libfdt for use in u-boot and adds a fdt command to allow easy manipulation of "fdt blobs."

Branches / Patches Queued for the Next Window


Checking for libfdt patches
  1. Clone the dtc
    • git clone git://git.jdl.com/software/dtc.git
  2. Find all changes in the libfdt/ subdirectory
    • git log libfdt/
  3. Find all the libfdt/ patchset hashes
    • git log libfdt/ | awk '/^commit/ {print $2}'

ToDo - libfdt

Ongoing: Catch up with dtc (libfdt/* to be slightly more explicit).

  • Upstream libfdt patchsets applied to the v2011.09 release:
    • 0329-Support-ePAPR-compliant-phandle-properties.patch
      • DTC commit: d75b33af676d0beac8398651a7f09037555a550b
      • U-Boot commit 05a22ba096fb996bb69ab020a8d08aafac2c28ba
    • 0344-libfdt-Implement-property-iteration-functions.patch
      • DTC commit 73dca9ae0b9abe6924ba640164ecce9f8df69c5a
      • U-Boot commit d1c6314887c4d6712f7bd9ba7428b6517e7732e0
  • Fix-a-possible-overflow-case-detected-by-gcc-4.3.2.patch - This upstream patch was applied to u-boot:
commit 13d93f38e86818739317b0206d597265cf9e675e
Author: Emil Medve <Emilian.Medve@Freescale.com>
Date:   Mon Feb 23 10:43:36 2009 -0600

Outstanding Patches


  1. For fdt addr, enhance to implement "fdt addr X +Y", where "Y" is the number of additional bytes to add to the blob.
  2. Suggestion from Timur:
    If the device tree is wrapped in a uimage (a 'dtu'), then the hdr→ih_load field contains the location where the device tree should be copied. If that value is zero, bad things happen. So I have two suggestions:
    1. If the value is zero, report an error and stop
    2. If the value is zero, assume the user doesn't want the device tree to be copied, and the code should fill it in with the current location of the device tree.
    I like option #2 better, because then I don't have to hard-code an address into the dtu.
  3. Save and load the blob to flash (likely after env space)
    • Add a CRC a'la env
    • Add a backup version a'la env
  4. Proposed additional fdt commands
    • merge - merge two trees. Need a conflict resolution: source tree #1 has priority?
      • David Gibson has talked about creating a "graft" function for libfdt.
    • load - load from flash
      • Not needed, see fdt move (but non-memory mapped storage such as NAND flash won't work with fdt move)
    • save - save to flash
      • cp should handle this already
    • header - print useful blob info like validity, version, total and used reserved slots, extra space, presence of <NOP> filling(?), etc.
      • Kumar submitted a patch to print the header info… some additional info showing extra space would be useful.

NOTE: Grant Likely has adapted libfdt for the 5xxx family, his methodology is the recommended template.

Background Information on Flattened Device Trees

1275 spec:

Power.org™ Standard for Embedded Power Architecture™ Platform Requirements (ePAPR)

PowerPC processor binding:

  • In the kernel source tree under Documentation/powerpc) - Describes the flat device tree as it is used in the Linux kernel.

Device Trees Everywhere-- paper by David Gibson and Ben Herrenschmidt-- an overview of the concept

PCI Bus binding:

USB Bus binding:

CHRP Binding:

64-bit extension:

Interrupt mappings ( very important ):

Misc device types (network, RTC, sound, etc)


All Your Base are Belong to Us

…aka some more git usage…

# See what branch I'm on (it happens to be master)
git branch

# Switch to my "sync with Wolfgang" branch (use -b the first time)
git checkout uboot

# Pull the latest u-boot.git (supreme master) changes into my uboot branch
git pull git://www.denx.de/git/u-boot.git

# Switch back to my master branch (where my pending changes are/would be)
git checkout master

# Rebase against u-boot.git latest
git rebase uboot

# Want to see what Kumar Gala is cooking with libfdt - start a new branch
git checkout -b galak

# Pull Kumar's libfdt branch
git pull git://git.kernel.org/pub/scm/boot/u-boot/galak/u-boot.git libfdt

# See what the changes are
git diff master

# Visual version

# Rebase against the master (which was rebased against Wolfgang's supreme 
# master), our (Kumar's) changes are now against the master.
git rebase master

Testing (not fdt-specific)

  • See DENX Universal Test System (DUTS)

>>> import serial
>>> ser = serial.Serial(0, 115200, timeout=100, parity=serial.PARITY_NONE, rtscts=0)
>>> ser.write("help\n")
>>> ser.inWaiting()
>>> s=ser.read(2304)
>>> print s
?       - alias for 'help'
askenv  - get environment variables from stdin
version - print monitor version
>>> ser.write("help\n")
>>> s = ser.read(100)
>>> print s
?       - alias for 'help'
askenv  - get environment variables from stdin
autoscr - run scri
>>> s = ser.readline()
>>> print s
pt from memory
>>> s = ser.readline()
>>> print s
base    - print or set address offset
Copyright © 2002-2022 by DENX Software Engineering GmbH ImprintTerms & ConditionsPrivacyFeedback
This website is using cookies. More info. That's Fine