Skip to main content.

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

libfdt

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).

commit 13d93f38e86818739317b0206d597265cf9e675e
Author: Emil Medve <Emilian.Medve@Freescale.com>
Date:   Mon Feb 23 10:43:36 2009 -0600

Outstanding Patches

ToDo

  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:

booting-without-of.txt

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)

Notes

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
gitk

# 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)

>>> import serial
>>> ser = serial.Serial(0, 115200, timeout=100, parity=serial.PARITY_NONE, rtscts=0)
>>> ser.write("help\n")
>>> ser.inWaiting()
2304L
>>> s=ser.read(2304)
>>> print s
help
?       - alias for 'help'
askenv  - get environment variables from stdin
:
:
version - print monitor version
=> 
>>> ser.write("help\n")
>>> s = ser.read(100)
>>> print s
help
?       - 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