[U-Boot] global data structure and standalone applications

Mike Frysinger vapier at gentoo.org
Tue Oct 25 14:21:16 CEST 2011


an outstanding question has been: do changes to global_data.h require
bumps in the standalone api version ?

the answer is "yes".  if we look at how EXPORT_FUNC() works, every
arch relies on the gd->jt offset being stable (see stubs.c).  if we
look at arches' global_data structure, the jt member is at the end of
the structure.  so any change to that offset requires a version bump.

however, if you just glance at the structures, you see a much bigger
problem: the interleaving of #ifdefs.  so any change in those will
implicitly break standalone applications.

looking even further, since standalone applications get access to the
entire gd_t and bd_t structures, so any change to those structures
implicitly change the standalone api.  while gd->jt is by far used
more often than any other member, some of the examples use other
struct members, and we can't say what random end user code does.

so perhaps the answer is to just scuttle exporting of the struct
completely.  we make the structure opaque to the standalone code, and
any members that we want to export to them, we create a dedicated
structure for sharing info which a syscall takes care of populating.
it seems the api/ code does something similar already, so we can unify
with that.  this should allow us to update the global/board structures
at will (even to the point of unifying them across arches), and make
it clear that changes to that exported structure will cause an api
bump.

if no complaints, i'll fix this.
-mike


More information about the U-Boot mailing list