[U-Boot] config: enable CONFIG_API in distro config

Ian Campbell ijc at hellion.org.uk
Sat Apr 19 16:34:08 CEST 2014


On Fri, 2014-04-18 at 11:23 -0600, Stephen Warren wrote:
> That said, I still conceptually object to config_distro_defaults.h
> enabling API support in order to support grub;

A worse problem is that I'm far from convinced that the API is suitable
to be used in production.

The mechanism for determining the API entry point involves scanning the
region around some address looking for a signature. The search area is
determined by the coincidence that the API signature struct is allocated
with u-boot's malloc and can therefore be found somewhere near the GD
pointer, which happens to be in a register which is luckily not
corrupted when booting. grub has a hack for at least one platform which
mallocd more data and therefore the signature ended up outside of the
region to be searched.

The calling convention is also somewhat poorly specified, and has been
broken at least once because the app is required to preserve u-boot's GD
pointer in the correct register and that register has changed at least
once inadvertently because the GD register isn't (wasn't?) considered
API. http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/174287

Maybe some of this is just down to the API not being very widely used in
practice, but to me it has the smell of a prototype which got out of
hand and became an API without someone revisiting the issues which made
it experimental to start with...

Look at the history of api/* and example/api/*. Other than occasional
build fixes and generic changes which touch it nothing has really
changed since the very first "experimental" commit...

Sorry if this comes across as ragging on the API, but my experience with
using it for grub-on-u-boot was incredibly frustrating and not very
reassuring...

Ian.



More information about the U-Boot mailing list