January 28, 2017

U-Boot as an information resource

I have notes elsewhere about configuring U-Boot to network boot an Orange Pi. This section discusses navigating the U-Boot source code to study how hardware is handled.

Anyone working with low level hardware aspects of a board like the Orange Pi will quickly realize the limitations of published documentation. A bit of thought will then bring to mind the fact that U-Boot runs nicely on the hardware, and that U-Boot is entirely open source and available for study. In addition, U-Boot is simpler than studying the linux sources (though it is complex enough).

Tools like "grep -R", ack, and ctags are useful, but U-Boot supports a tremendous diversity of hardware and the student finds himself continually tripping over files that are entirely irrelevant for the Hardware in question. What I have found extremely handy is to configure and build U-Boot, then the object files generated by the build process serve as "breadcrumbs". If a given C file has no ".o" file alongside, it is not part of the current build! I have been tempted to generate a script that would use these hints to delete every irrelevant file and generated a pruned source tree for purposes of study, but have not yet done so.

U-Boot startup

This is surprisingly complex. On the system in question, the show starts in:
arch/arm/cpu/armv7/start.S
This calls _main, which is surprisingly in:
arch/arm/lib/crt0.S


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org