19746aeb8SBrad Bishop# OpenBMC meta layer guidelines 2d078e0d2SEd Tanous 3d078e0d2SEd TanousWhile most of these could be called "rules", in specific scenarios might be 4*f4febd00SPatrick Williamsactively against the intended goals. This is why each guideline has a very large 5*f4febd00SPatrick Williams"Why" section, to ensure that the intent is being met, and that if exceptions to 6*f4febd00SPatrick Williamsthe rules exist, then can be understood and managed by the project. In general, 7*f4febd00SPatrick Williamsif there's a question, and the community agrees, these guidelines can be 8*f4febd00SPatrick Williamsoverridden on a case by case basis. 9d078e0d2SEd Tanous 109746aeb8SBrad Bishop## Meta layers should not patch projects that exist within the openBMC tree 11d078e0d2SEd Tanous 129746aeb8SBrad Bishop**Why?** 139746aeb8SBrad Bishop 14*f4febd00SPatrick WilliamsIn general, keeping the codebase building in the long term is difficult. Opening 15*f4febd00SPatrick Williamsthe possibility that patches exist that repo maintainers aren't aware of makes 16*f4febd00SPatrick Williamsit much more likely that a single machine breaks, or we have behavior 17d078e0d2SEd Tanousdifferences between two repos. 189746aeb8SBrad Bishop 19d078e0d2SEd TanousAlso, in general, the maintainer is there to ensure that the greater community, 20d078e0d2SEd Tanousfeatures, and codebase are prioritized over any one patch, and generally does so 21d078e0d2SEd Tanousin code review. If patches are checked into meta layers, generally the 22d078e0d2SEd Tanousmaintainer is not a reviewer, thereby defeating most of the purpose of the role 23d078e0d2SEd Tanousof the maintainer. 24d078e0d2SEd Tanous 259746aeb8SBrad Bishop**What should I do instead?** 269746aeb8SBrad Bishop 27d078e0d2SEd TanousDiscuss with the project maintainers and the community about whether or not the 28d078e0d2SEd Tanousfeature you're building needs to be configurable, or if it can be applied to all 29d078e0d2SEd Tanousprojects. If it can be applied to all, simply check it into the master branch 30d078e0d2SEd Tanousthrough a gerrit review, and follow the processes outlined for the repository. 31d078e0d2SEd TanousIf it needs to be per-project or per-machine configurable, check it in under a 32d078e0d2SEd Tanouscompile time option, at the suggestion of the maintainer, and add a 33d078e0d2SEd TanousPACKAGECONFIG entry that can be set to enable it. 34d078e0d2SEd Tanous 359746aeb8SBrad Bishop## Meta layers should not patch Yocto recipes and projects 36d078e0d2SEd Tanous 379746aeb8SBrad Bishop**Why?** 389746aeb8SBrad Bishop 39d078e0d2SEd TanousYocto itself is an open source project that accepts contributions. The more 40d078e0d2SEd Tanouschanges that OpenBMC stacks against Yocto recipes, the more unmaintainable it 41d078e0d2SEd Tanousbecomes, and the longer it takes to rebase to new Yocto versions. In general, 42d078e0d2SEd Tanousthe Yocto community is as responsive (sometimes much faster) than the OpenBMC 43d078e0d2SEd Tanouscommunity in regards to pull requests. 44d078e0d2SEd Tanous 459746aeb8SBrad Bishop**What should I do instead?** 469746aeb8SBrad Bishop 47d078e0d2SEd TanousSubmit any changes needed to the Yocto upstream repositories, using their 48d078e0d2SEd Tanousprocess. If the Yocto process has gone several weeks without responses, 49d078e0d2SEd Tanouscherry-pick the commit into the OpenBMC tree, with a pointer to the review in 50c9fb5ea7SEd Tanousthe commit message, and documentation. The patch commit message should follow 51c9fb5ea7SEd Tanousthe Yocto requirements for patch comments, including a statement of the patch 52c9fb5ea7SEd Tanousupstream status. 53c9fb5ea7SEd Tanous[yocto patch requirements](https://wiki.yoctoproject.org/wiki/Best_Known_Methods_%28BKMs%29_for_Package_Updating#Patch_Comments) 54d078e0d2SEd Tanous 559746aeb8SBrad Bishop## Meta layers should avoid using EXTRA_OEMAKE and EXTRA_OEMESON 56d078e0d2SEd Tanous 579746aeb8SBrad Bishop**Why?** 589746aeb8SBrad Bishop 59d078e0d2SEd TanousThere are some OpenBMC projects that are utilized outside of OpenBMC. As such, 60d078e0d2SEd Tanousthere are configuration items that are not intended to be used in OpenBMC, or 61*f4febd00SPatrick Williamsconfiguration items that would pose a security risk. Also, as options change and 62*f4febd00SPatrick Williamsare deprecated, the project needs a single place to update the available config 63*f4febd00SPatrick Williamsitems and dependencies. 649746aeb8SBrad Bishop 65d078e0d2SEd TanousIn addition, subprojects might change their build tooling, for example from 66d078e0d2SEd Tanousautotools to meson, in pursuit of other goals. Having tool-specific 67d078e0d2SEd Tanousconfigurations makes that change far more difficult to do. 68d078e0d2SEd Tanous 699746aeb8SBrad Bishop**What should I do instead?** 709746aeb8SBrad Bishop 71d078e0d2SEd TanousIn the root recipe, add a PACKAGECONFIG entry for the feature in question, then 72d078e0d2SEd Tanoususe that to enable said feature in your meta layer. 73d078e0d2SEd Tanous 749746aeb8SBrad Bishop## Meta layers should not have recipes that point to proprietary licensed code 75d078e0d2SEd Tanous 769746aeb8SBrad Bishop**Why?** 779746aeb8SBrad Bishop 78d078e0d2SEd TanousOpenBMC is an open source project, and is intended to be built from source, with 79d078e0d2SEd Tanousappropriate distribution licenses such that it can be reused. Pointing to 80d078e0d2SEd Tanouscommercially licensed repositories actively opposes that goal. 81d078e0d2SEd Tanous 829746aeb8SBrad Bishop**What should I do instead?** 839746aeb8SBrad Bishop 84d078e0d2SEd TanousFind an equivalent open source project that meets the needs, or request that the 85d078e0d2SEd Tanousproject owner relicenses their project. 86d078e0d2SEd Tanous 879746aeb8SBrad Bishop## Meta layer recipes should only point to well maintained open source projects 88d078e0d2SEd Tanous 899746aeb8SBrad Bishop**Why?** 909746aeb8SBrad Bishop 91d078e0d2SEd TanousWithout this guideline, a loophole is present that allows OpenBMC developers to 92d078e0d2SEd Tanousbypass code review by pointing the upstream recipe to a public repository that 93d078e0d2SEd Tanousthey control, but which OpenBMC has no input on the content of. This splits the 94d078e0d2SEd Tanousdiscussion forums in unproductive ways, and prevents all the other good 95d078e0d2SEd Tanousprocesses within OpenBMC like bug tracking and continuous integration from 96d078e0d2SEd Tanoushaving an effect. 97d078e0d2SEd Tanous 989746aeb8SBrad Bishop**What should I do instead?** 999746aeb8SBrad Bishop 100d078e0d2SEd TanousThe advice tends to be on a case by case basis, but if the code is only intended 101d078e0d2SEd Tanousfor use on OpenBMC, then push a design doc, and push the code to openbmc gerrit 102d078e0d2SEd Tanousunder the openbmc/openbmc repository where it can be reviewed, along with an 103*f4febd00SPatrick WilliamsOWNERS file, signaling your willingness to maintain this project. Then, once the 104*f4febd00SPatrick Williamscommunity has looked through your design, a repo will be created for code to be 105*f4febd00SPatrick Williamspushed to. If you're pulling in code from a dead project, inquire to the 106d078e0d2SEd Tanouscommunity through the mailing list or discord whether or not the OpenBMC 107d078e0d2SEd Tanouscommunity would be willing to adopt support and maintenance of said project. 108d078e0d2SEd Tanous 109d3b3bf70SEd Tanous## Meta layers should not point to OpenBMC specific repositories outside of 110*f4febd00SPatrick Williams 111d3b3bf70SEd Tanoushttps://github.com/openbmc 112d3b3bf70SEd Tanous 113d3b3bf70SEd Tanous**What defines an OpenBMC specific repository?** 114d3b3bf70SEd Tanous 115d3b3bf70SEd TanousGenerally an OpenBMC specific repository is something that does any of the 116d3b3bf70SEd Tanousfollowing: 117*f4febd00SPatrick Williams 118*f4febd00SPatrick Williams- Relies on or implements on OpenBMC defined Dbus interfaces. 119*f4febd00SPatrick Williams- Is not designed with configurability to be used outside of OpenBMC 120*f4febd00SPatrick Williams- Relies on OpenBMC specific layouts, configuration information to accomplish 121d3b3bf70SEd Tanous its primary function. 122d3b3bf70SEd Tanous 123d3b3bf70SEd Tanous**Why?** 124d3b3bf70SEd Tanous 125d3b3bf70SEd TanousOpenBMC as a codebase needs to remain buildable in the long term. Companies, 126d3b3bf70SEd Tanousmaintainers, and contributors come and go over the course of the project. 127d3b3bf70SEd TanousKeeping all long-term-supported code in the OpenBMC github ensures that the 128d3b3bf70SEd Tanousproject will remain useful. In addition, having significant portions of 129*f4febd00SPatrick WilliamsOpenBMC-specific code outside of github limits the ability of the project to do 130*f4febd00SPatrick Williamsrefactoring that might be necessary to keep up with the latest best practices, 131*f4febd00SPatrick WilliamsYocto updates, and package revisions, as there isn't always a clear path to 132*f4febd00SPatrick Williamsgetting patches accepted when repositories are not within the OpenBMC github 133*f4febd00SPatrick Williamsproject 134d3b3bf70SEd Tanous 135d3b3bf70SEd Tanous**What should I do instead?** 136d3b3bf70SEd Tanous 137d3b3bf70SEd TanousDiscuss the code you'd like to write with the community using the mailing list 138d3b3bf70SEd Tanousand/or discord. If the design would require a new repository, request one using 139d3b3bf70SEd Tanousthe OpenBMC technical oversight committee process. 140d3b3bf70SEd Tanous 1419746aeb8SBrad Bishop## Don't use SRCREV="${AUTOREV}" in a recipe 142d078e0d2SEd Tanous 1439746aeb8SBrad Bishop**Why?** 1449746aeb8SBrad Bishop 145d078e0d2SEd TanousRepository branches can change at any time. Pointing to an autorev revision 146d078e0d2SEd Tanousincreases the likelihood that builds break, and makes builds far less 147d078e0d2SEd Tanousreproducible. 1489746aeb8SBrad Bishop 149d078e0d2SEd TanousIn addition, having an accounting of exactly what is in your build prevents 150d078e0d2SEd Tanouserrors when a repo is quietly updated while working, and suddenly changes 151d078e0d2SEd Tanoussignificantly. 152d078e0d2SEd Tanous 1539746aeb8SBrad Bishop**What should I do instead?** 1549746aeb8SBrad Bishop 155d078e0d2SEd TanousPoint SRCREV to a specific commit of the repository, and increase the revision 156d078e0d2SEd Tanouseither via the autobump script in CI, which can be requested on the mailing 157d078e0d2SEd Tanouslist, or manually as new revisions exist. 158