[U-Boot] [RFC][PATCH] Generate CRC of structure of Global Data for standalone apps

Graeme Russ graeme.russ at gmail.com
Sun Sep 4 01:50:12 CEST 2011


On 04/09/11 05:44, Wolfgang Denk wrote:
> Dear Graeme Russ,
> 
> In message <4E621E4E.8010703 at gmail.com> you wrote:
>>
>> Back the original question that spawned this - asked several times and
>> never answered - Does a modification to the Global Data structure trigger
>> an increment of XF_VERSION?
> 
> I don't think so.  But I have to admit that I never thoroughly
> verifyed this either.  The standalone code itself is not suposed to
> reference GD in any way; and the U-Boot routines that the standalone
> call can call are runnign in the context of the current U-Boot, where
> everything fits together.  So unless somebody misuses something, it
> should all work out well.  At least, that's my theory.

So perhaps this should be removed from exports.h:

#if defined(CONFIG_X86)
extern gd_t *global_data;
#endif

And document that standalone applications must not directly access the
global data structure.

The whole point of the patch was that it is critical that when a standalone
application accesses global data, the version of the structure that it is
accessing is exactly the same as the version being accessed by U-Boot.
There are two ways of handling this:

1) Add an export function to access global data members by name (reporting
an error if the member does not exist)
2) 'Sign' the structure of the global data (this patch)

Regards,

Graeme


More information about the U-Boot mailing list