Skip to content

Instantly share code, notes, and snippets.

@swetland
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swetland/bb753d1aca5f2b5f2a17 to your computer and use it in GitHub Desktop.
Save swetland/bb753d1aca5f2b5f2a17 to your computer and use it in GitHub Desktop.
Device Tree Brain Damage
I've just had my first encounter with the wonders of "DeviceTree" and I am unimpressed...
- mandatory big-endian everything, regardless of target architecture
- incurs poinless byte swapping penalty on all major architectures
- byteswap macro noise in kernel source
- string matching for names and propertynames
- no good indication of missing/invalid properties, etc
- no way to sanity check except by visual inspection (good luck!)
- some strings are inline, some are in the stringtable
- data is untyped, so while the textual format sort of deals with arrays-of-bytes,
arrays-of-words, or strings, the binary format is just big-bag-of-bytes
- more opportunity for failure due to potentially undetectable invalid data format
- word-boundary-alignment required periodically
- could be avoided for namestrings if they used the stringtable like propertynames...
- could be avoided for valuestrings if they used the stringtable...
- necessity for bootloaders to *modify* this stuff (which is error-prone) to:
- pass correct values for initrd-start/end
- pass kernel commandline
- pass memory exclusion regions
- possibly pass partition data, etc
- more data structures to grind over at boot
- separating the data from the kernel means there are now more exciting ways for things to break
In the old board files and platform_data world, one could take advantage of the C compiler
to provide some amount of type safety and compile time checking. In the new device tree
world, you have the device tree text files, the kernel source code, bootloaders that need
to deal with the format, and a pile of text files under Documentation/devicetree/bindings/...
that there are no guarantees about any of this madness staying in sync and no reasonable way
to check for problems at build time *or* runtime. Ugh.
In addition, now not only do I need to keep track of the kernel, bootloader, and initrd, but
I have this other piece of metadata that is essential to things working that I have to hang
on to and make sure doesn't get out of date compared to everything else.
In only a few hours of fighting with system bringup in this glorious new world, I have
developed some serious hatred for this mess.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment