[yocto] How to write a distro layer?
Uwe Geuder
jrswdnan22 at snkmail.com
Fri Aug 3 01:39:10 PDT 2018
Hi!
[Disclaimer: I have posted a similar message months ago. There were no
replies. Let's try whether I can express myself clearer this time.]
One of the few informations I could find about how to create my own
layer was something like
https://www.openembedded.org/wiki/Creating_a_new_Layer
Especially for creating a distro layer that does not give much guidance.
I could not find any examples of distro layers (except poky of course)
on the net. Can somebody give me pointers?
The auto-generated local.conf mentions subclassing
poky. Is that concept explained anywhere?
I inherited a distro layer, which sets a lot of its policy (selection of
systemd and other feature/package selection) in layer.conf. From reading
the documentation and other layer.conf files I understand that is NOT
the way to do it. I would expect those settings in distro/<distro>.conf.
The yocto reference manual says for many variables: "Set it in your
local.conf". For me they are policy, so why shouldn't I set them in
distro/<distro>.conf?
Well, basically there is only one configuration in bitbake. So often it
does not matter in what configuration file a variable is set. The
setting will end up in the environment of the tasks. However, especially
when the ?= operator is used order becomes significant.
Particularly tricky I found the DISTRO variable.
Our distro layer does
1.) set the DISTRO variable in layer.conf (according to the manual it
should be done in local.conf)
2.) from distro/<distro>.conf include (well, require) poky.conf. Is
that a big no-no??? Of course I could copy all settings I want to keep from
poky (and all those I don't understand what they do...), but copying code
is generally not good SW engineering, including sounds better.
3.) set DISTRO again after having included poky.conf . According to
the yocto-check-layer script a distro must not set its own
name. However, poky does not follow that rule and sets its name, so our
code has to violate the rule once more and revert poky's wrongdoing.
In an attempt to make our code more in line with what I understand to be
correct style, I tried to move all policy settings to
distro/<distro>.conf and the DISTRO setting to local.conf.
However that created a couple of problems:
1. If I set DISTRO in local.conf before adding all needed layers, my own
distro layer last, bitbake-layers fails in a sanity check that the
distro does not exist. Fair enough, it doesn't know about before it has
been added.
2. If I first modify my local.conf with all my settings except DISTRO,
then run all the add-layer operations and finally modify local.conf a
2nd time to set DISTRO correctly the build works. However, all recipes
are reparsed when the build starts. I guess this is caused by the config
change.
So in the end having the DISTRO setting in layer.conf seems to work
best. All add-layer commands succeed and recipes can be used from the
cache when the build starts. Best, except that I don't think that's the
way it's documented.
Any thoughts what I might be missing?
Regards,
Uwe
Uwe Geuder
Neuro Event Labs Oy
Tampere, Finland
uwe.gexder at neuroeventlabs.com (Bot check: fix one obvious typo)
More information about the yocto
mailing list