[yocto] Difference between bitbake inclusion and inheritance
Paul Eggleton
paul.eggleton at linux.intel.com
Tue Oct 18 19:00:59 PDT 2016
Hi Davis,
On Tue, 18 Oct 2016 18:37:50 Davis Roman wrote:
> I'm a yocto newbie and so I'm becoming familiar with the documentation.
>
> I came across a bitbake feature that is somewhat confusing to me regarding
> the difference between optional/required inclusion versus inheritance.
>
> As far as optional/required inclusion is concerned, the documentation
> states quite clearly that the main difference is that the former will not
> issue an error message if the specified file is not found while the latter
> will so there is no issue here.
>
> My issue has to do with the 'inherit' command. Sounds to me like 'include'
> and 'require' already do the trick so I'm curious to know what value does
> 'inherit' bring ?
The answer is that they are very similar - but tend to be used for slightly
different purposes. inherit is for where you have some functionality that you
expect to be applicable across a number of recipes, so it should show up in a
standard location in a reasonably standard format. The technical differences
really stem from that:
* Classes must appear in a classes subdirectory somewhere along BBPATH
* Classes must be named <something>.bbclass
* Classes can use EXPORT_FUNCTIONS so you can still call the original function
from your overridden version
* It's easy to query from python code whether a recipe inherits a class (and
it's something we do in quite a number of places); it's technically possible
to do the same for include/require but more difficult
include/require are much more generic and applicable for any other kind of
shared or encapsulated functionality or configuration that doesn't suit a
.bbclass.
Note that not all classes are typically inherited from individual recipes with
inherit - there are classes that are usually applied globally by adding their
names to INHERIT (e.g. buildhistory).
Hope that helps.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
More information about the yocto
mailing list