Bug 5037 - BSP layer included in bblayers.conf when building other MACHINEs
Summary: BSP layer included in bblayers.conf when building other MACHINEs
Status: RESOLVED FIXED
Alias: None
Product: BSP Guide
Classification: Documentation
Component: bsp-docs (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.5
Assignee: Scott Rifenbark
QA Contact:
URL:
Whiteboard: 18 September 2013: RESOLVED
Depends on:
Blocks:
 
Reported: 2013-08-21 22:05 UTC by Martin Jansa
Modified: 2013-09-19 00:58 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Done (doc changes complete)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Jansa 2013-08-21 22:05:45 UTC
Properly written BSP layers shouldn't break builds of other MACHINEs when they are included in BBLAYERS.

Can you extend http://www.yoctoproject.org/docs/current/bsp-guide/bsp-guide.html to explicitly say that BSP layer shouldn't change metadata for other MACHINEs (i.e. describe that MACHINE overrides have to be used for each assignment/append and MACHINE subdirectories for files used from SRC_URI)?

With right use of overrides adding BSP layer in BBLAYERS should only increment some PRINC values and _add_ support for more MACHINEs without unexpected changes to other MACHINEs.

It's hard to explain this to some people and having link to some well written documentation would help a lot, thanks.
Comment 1 Jessica 2013-08-22 14:39:39 UTC
Scott,

Can you work with Martin to add the correct content?

Thank,
Jessica
Comment 2 Scott Rifenbark 2013-08-26 05:47:43 UTC
Hi Martin, 

Is this fix precautionary?  Or did you run into a situation where a BSP layer broke a build of another MACHINE?  Understanding this will help me better place this fix to the documentation.

Thanks,
Scott
Comment 3 Martin Jansa 2013-08-26 07:12:04 UTC
> Is this fix precautionary? Or did you run into a situation where a BSP layer broke a build of another MACHINE?

It was discussed few times on ML, but when I'm reporting such issues in some BSP layers I sometimes need to persuade BSP maintainer why he should care about this. 

Sending him links to ML archives doesn't work well, having clear description in official documentation will add more weight to my arguments :).
Comment 4 Scott Rifenbark 2013-09-11 15:41:15 UTC
Martin, 

I am not sure I have the technical understanding for this yet so I am going to take a stab at a paragraph and maybe you can comment/correct me.  Right now I am going to target this new information at the end of the "Hardware Configuration Options" section of the BSP Manual (http://www.yoctoproject.org/docs/1.5/bsp-guide/bsp-guide.html#bsp-filelayout-machine).  If that is not the best place let me know where you think it better fits. 

Here is my text....

Configuring the hardware properly in a BSP layer will not break builds for other machines when their layers are also included in the bblayers.conf file.  You can ensure this by using MACHINE overrides for assignments and appends specific to a particular target machine.  You need to also use MACHINE subdirectories for files pointed to by the SRC_URI variable.

Okay Martin.. so this is terrible because I am missing the concepts of how you actually do this because I am not a developer.  So, I have basically just re-worked your statements from your comments.  I think what I need is some "education" here from you that will give me more understanding on how a user actually does this.  I am not clear on "overrides" and "appends" as stated in your comments.  

Thanks for your help!
Scott
Comment 5 Martin Jansa 2013-09-11 22:07:06 UTC
I'll try to give you some examples of typical issues, maybe you'll be able to convert them to some nice explanation.

you have BSP layer
meta-abc which adds support for MACHINE "abc"

you have .bbappend file for base-files recipe and you want to change some variables to improve support for MACHINE "abc"

If you just set it like

DEPENDS = "foo"

then base-files for MACHINE "def" will now also depends on "foo" if you have meta-abc layer included when building for "def". You need to use

DEPENDS_abc = "foo"

which says that "foo" should be used only when meta-abc layer is included and MACHINE is "abc".

Similar for _append/_prepend operations:

instead of
DEPENDS_append = " foo"
which is applied to all possible MACHINEs, use:
DEPENDS_append_abc = " foo"

+=,=+ which are also applied for all MACHINEs should be rewritten to use _append and _<machine> override.

When you have base recipe like base-files.bb which contains
SRC_URI = "file://rotation" ...
you can add base-files.bbappend which will use your own rotation file provided by meta-abc layer.

recipes-core/base-files/base-files.bbappend:
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
and put "abc" specific rotation file in:
"recipes-core/base-files/base-files/rotation"
and it will be automatically used instead of default rotation file from oe-core, but again this file can be used for every MACHINE as long as meta-abc/recipes-core/base-files/base-files/ is first location where rotation file is found in FILESPATH variable. Because we don't want to use this rotation file for other MACHINEs put it in "meta-abc/recipes-core/base-files/base-files/abc/rotation" it will be found faster and without danger of unexpectedly using this "abc" specific file in build for "def" MACHINE.

Reading this again I have to say, that I suck as documentation writer, hopefully you'll understand from it what are the issues and how "proper" BSPs are fixing them, we can chat about this a bit more on #yocto if you prefer it. Or ask anyone from local devs for more detailed explanation.
Comment 6 Scott Rifenbark 2013-09-12 22:06:40 UTC
Hi, 

I have attempted a shot at this Martin.  The topic got quite complicated for me so read it and see where I have gone wrong or where you think it could be improved upon.  I located the information in the YP Development Manual.  I had some "Best Practices" and "Recommendations" somewhat buried in a section on creating layers.  So, I split that section up leaving the original to cover just the basic steps for creating layers.  The existing "buried" recommendations and best practices I combined into a new section titled "Best Practices to Follow when Creating Layers."

Here is the link to the new section.  Let me know here in Bugzilla with your comments:

http://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers

Thanks, 
Scott
Comment 7 Martin Jansa 2013-09-12 22:49:04 UTC
I've couple of comments:

- create a dependency on a file named foo that contains the altered variables:
+ create a dependency on "foo" by altering DEPENDS variable:

-  _append and _prepend overrides:
 _append and _prepend aren't overrides, but operations like (+=,=+).
 the same a bit later in "Note".
Comment 8 Scott Rifenbark 2013-09-12 23:43:36 UTC
Hi, 

I feel pretty successful if those are the only issues Martin :)

Thanks.

I have made those changes.

http://www.yoctoproject.org/docs/1.5/dev-manual/dev-manual.html#best-practices-to-follow-when-creating-layers

Scott
Comment 9 Scott Rifenbark 2013-09-19 00:58:40 UTC
No more review comments submitted.  So marking RESOLVED.