On Sat, Jan 28, 2012 at 6:18 AM, Paul Eggleton <[email protected]> wrote: > On Saturday 28 January 2012 13:42:32 Frans Meulenbroeks wrote: >> In order to allow backtracking of the sources for a binary build with OE, I >> would like to (automatically) add the hash of the top level commit (and >> maybe also the branch) of the oe git tree my recipe lives in). >> E.g. in main.c I would like to have a var say: >> const char * const buildfrom = "oe branch 2011.03-maintence hash >> 1234567890"; or something like that. >> >> What would be the best way to get that info into my program? >> (my best guess at the moment is to use a macro and compile with >> -DOE_IDENT="....." or so and say char *buildfrom = OE_IDENT; but not >> really sure what the best way is to fill OE_IDENT and pass it to the >> recipe.) > > Interesting question! Putting the information in a define specified on the > compiler command line would be one way; another way would be to have the > recipe write to/append to/subsitute into a header file that you can #include > in > the source. You would also probably want to include ${DATE} in the recipe's PV > or use some other mechanism to ensure it gets rebuilt every time you build an > image.
use python-fu to grok it from metadata dump this into a .h file during do_configure and movie that headerfile into the sources then include it in your .c and use it. > > I guess you are still using OE-Classic, but in OE-Core we now have a function > in base.bbclass called get_layers_branch_rev that will return the git > branch/revision information for all enabled layers. It was split out from the > code in the same bbclass that displays this information when BitBake starts, > so I guess you could just make a copy of it into your recipe for OE-Classic. > > Cheers, > Paul > > -- > > Paul Eggleton > Intel Open Source Technology Centre > > _______________________________________________ > Openembedded-devel mailing list > [email protected] > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel _______________________________________________ Openembedded-devel mailing list [email protected] http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
