David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 1 | Contribution Guidelines |
| 2 | ####################### |
| 3 | |
| 4 | As an open-source project, we welcome and encourage the community to submit |
| 5 | patches directly to the project. In our collaborative open source environment, |
| 6 | standards and methods for submitting changes help reduce the chaos that can result |
| 7 | from an active development community. |
| 8 | |
| 9 | This document explains how to participate in project conversations, log bugs |
| 10 | and enhancement requests, and submit patches to the project so your patch will |
| 11 | be accepted quickly in the codebase. |
| 12 | |
| 13 | |
| 14 | Licensing |
| 15 | ********* |
| 16 | |
| 17 | Licensing is very important to open source projects. It helps ensure the |
| 18 | software continues to be available under the terms that the author desired. |
| 19 | |
| 20 | .. _Apache 2.0 license: |
| 21 | https://github.com/zephyrproject-rtos/zephyr/blob/master/LICENSE |
| 22 | |
| 23 | .. _GitHub repo: https://github.com/zephyrproject-rtos/zephyr |
| 24 | |
David B. Kinder | 10b24a8 | 2017-09-19 17:23:35 -0700 | [diff] [blame] | 25 | Zephyr uses the `Apache 2.0 license`_ (as found in the LICENSE file in |
| 26 | the project's `GitHub repo`_) to strike a balance between open |
| 27 | contribution and allowing you to use the software however you would like |
| 28 | to. The Apache 2.0 license is a permisive open source license that |
| 29 | allows you to freely use, modify, distribute and sell your own products |
| 30 | that include Apache 2.0 licensed software. (For more information about |
| 31 | this, check out articles such as `Why choose Apache 2.0 licensing`_ and |
| 32 | `Top 10 Apache License Questions Answered`_). |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 33 | |
David B. Kinder | 10b24a8 | 2017-09-19 17:23:35 -0700 | [diff] [blame] | 34 | .. _Why choose Apache 2.0 licensing: |
David B. Kinder | fafff0f | 2017-11-03 15:12:06 -0700 | [diff] [blame] | 35 | https://www.zephyrproject.org/about/#faq |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 36 | |
David B. Kinder | 10b24a8 | 2017-09-19 17:23:35 -0700 | [diff] [blame] | 37 | .. _Top 10 Apache License Questions Answered: |
| 38 | https://www.whitesourcesoftware.com/whitesource-blog/top-10-apache-license-questions-answered/ |
| 39 | |
| 40 | A license tells you what rights you have as a developer, as provided by the |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 41 | copyright holder. It is important that the contributor fully understands the |
| 42 | licensing rights and agrees to them. Sometimes the copyright holder isn't the |
| 43 | contributor, such as when the contributor is doing work on behalf of a |
| 44 | company. |
| 45 | |
David B. Kinder | 10b24a8 | 2017-09-19 17:23:35 -0700 | [diff] [blame] | 46 | Components using other Licenses |
| 47 | =============================== |
| 48 | |
| 49 | There are some imported or reused components of the Zephyr project that |
| 50 | use other licensing, as described in `Zephyr Licensing`_. |
| 51 | |
| 52 | .. _Zephyr Licensing: |
| 53 | https://www.zephyrproject.org/doc/LICENSING.html |
| 54 | |
| 55 | Importing code into the Zephyr OS from other projects that use a license |
| 56 | other than the Apache 2.0 license needs to be fully understood in |
| 57 | context and approved by the Zephyr governing board. |
| 58 | |
Christoph Sax | 885f0b4 | 2017-11-04 16:15:07 +0100 | [diff] [blame] | 59 | By carefully reviewing potential contributions and also enforcing a |
| 60 | :ref:`DCO` for contributed code, we can ensure that |
David B. Kinder | 10b24a8 | 2017-09-19 17:23:35 -0700 | [diff] [blame] | 61 | the Zephyr community can develop products with the Zephyr Project |
| 62 | without concerns over patent or copyright issues. |
| 63 | |
| 64 | See `Contributing non-Apache 2.0 components`_ for more information about |
| 65 | this contributing and review process for imported components. |
| 66 | |
| 67 | .. _Contributing non-Apache 2.0 components: |
| 68 | https://www.zephyrproject.org/doc/contribute/contribute_non-apache.html |
| 69 | |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 70 | .. _DCO: |
| 71 | |
| 72 | Developer Certification of Origin (DCO) |
| 73 | *************************************** |
| 74 | |
| 75 | To make a good faith effort to ensure licensing criteria are met, the Zephyr |
| 76 | project requires the Developer Certificate of Origin (DCO) process to be |
| 77 | followed. |
| 78 | |
| 79 | The DCO is an attestation attached to every contribution made by every |
| 80 | developer. In the commit message of the contribution, (described more fully |
| 81 | later in this document), the developer simply adds a ``Signed-off-by`` |
| 82 | statement and thereby agrees to the DCO. |
| 83 | |
| 84 | When a developer submits a patch, it is a commitment that the contributor has |
| 85 | the right to submit the patch per the license. The DCO agreement is shown |
| 86 | below and at http://developercertificate.org/. |
| 87 | |
| 88 | |
| 89 | .. code-block:: none |
| 90 | |
| 91 | Developer's Certificate of Origin 1.1 |
| 92 | |
| 93 | By making a contribution to this project, I certify that: |
| 94 | |
| 95 | (a) The contribution was created in whole or in part by me and I |
| 96 | have the right to submit it under the open source license |
| 97 | indicated in the file; or |
| 98 | |
| 99 | (b) The contribution is based upon previous work that, to the |
| 100 | best of my knowledge, is covered under an appropriate open |
| 101 | source license and I have the right under that license to |
| 102 | submit that work with modifications, whether created in whole |
| 103 | or in part by me, under the same open source license (unless |
| 104 | I am permitted to submit under a different license), as |
| 105 | Indicated in the file; or |
| 106 | |
| 107 | (c) The contribution was provided directly to me by some other |
| 108 | person who certified (a), (b) or (c) and I have not modified |
| 109 | it. |
| 110 | |
| 111 | (d) I understand and agree that this project and the contribution |
| 112 | are public and that a record of the contribution (including |
| 113 | all personal information I submit with it, including my |
| 114 | sign-off) is maintained indefinitely and may be redistributed |
| 115 | consistent with this project or the open source license(s) |
| 116 | involved. |
| 117 | |
| 118 | DCO Sign-Off Methods |
| 119 | ==================== |
| 120 | |
| 121 | The DCO requires a sign-off message in the following format appear on each |
| 122 | commit in the pull request:: |
| 123 | |
| 124 | Signed-off-by: Zephyrus Zephyr <zephyrus@zephyrproject.org> |
| 125 | |
| 126 | The DCO text can either be manually added to your commit body, or you can add |
| 127 | either ``-s`` or ``--signoff`` to your usual Git commit commands. If you forget |
| 128 | to add the sign-off you can also amend a previous commit with the sign-off by |
| 129 | running ``git commit --amend -s``. If you've pushed your changes to GitHub |
| 130 | already you'll need to force push your branch after this with ``git push -f``. |
| 131 | |
| 132 | |
| 133 | Prerequisites |
| 134 | ************* |
| 135 | |
| 136 | .. _Zephyr Project website: https://zephyrproject.org |
| 137 | |
| 138 | As a contributor, you'll want to be familiar with the Zephyr project, how to |
| 139 | configure, install, and use it as explained in the `Zephyr Project website`_ |
| 140 | and how to set up your development environment as introduced in the Zephyr |
| 141 | `Getting Started Guide`_. |
| 142 | |
| 143 | .. _Getting Started Guide: |
| 144 | https://www.zephyrproject.org/doc/getting_started/getting_started.html |
| 145 | |
| 146 | The examples below use a Linux host environment for Zephyr development. |
Anas Nashif | 602a143 | 2017-10-31 08:35:24 -0400 | [diff] [blame] | 147 | You should be familiar with common developer tools such as Git and CMake, and |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 148 | platforms such as GitHub. |
| 149 | |
| 150 | If you haven't already done so, you'll need to create a (free) GitHub account |
| 151 | on http://github.com and have Git tools available on your development system. |
| 152 | |
| 153 | Repository layout |
| 154 | ***************** |
| 155 | |
| 156 | To clone the main Zephyr Project repository use:: |
| 157 | |
| 158 | $ git clone https://github.com/zephyrproject-rtos/zephyr |
| 159 | |
| 160 | The Zephyr project directory structure is described in `Source Tree Structure`_ |
| 161 | documentation. In addition to the Zephyr kernel itself, you'll also find the |
| 162 | sources for technical documentation, sample code, supported board |
| 163 | configurations, and a collection of subsystem tests. All of these are |
| 164 | available for developers to contribute to and enhance. |
| 165 | |
| 166 | .. _Source Tree Structure: |
| 167 | https://www.zephyrproject.org/doc/kernel/overview/source_tree.html |
| 168 | |
| 169 | Pull Requests and Issues |
| 170 | ************************ |
| 171 | |
Anas Nashif | 37b9ee0 | 2017-10-02 22:33:16 -0400 | [diff] [blame] | 172 | .. _Zephyr Project Issues: https://github.com/zephyrproject-rtos/zephyr/issues |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 173 | |
| 174 | .. _open pull requests: https://github.com/zephyrproject-rtos/zephyr/pulls |
| 175 | |
| 176 | .. _Zephyr-devel mailing list: |
| 177 | https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel |
| 178 | |
Anas Nashif | 37b9ee0 | 2017-10-02 22:33:16 -0400 | [diff] [blame] | 179 | Before starting on a patch, first check in our issues `Zephyr Project Issues`_ |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 180 | system to see what's been reported on the issue you'd like to address. Have a |
| 181 | conversation on the `Zephyr-devel mailing list`_ (or the #zephyrproject IRC |
| 182 | channel on freenode.net) to see what others think of your issue (and proposed |
| 183 | solution). You may find others that have encountered the issue you're |
| 184 | finding, or that have similar ideas for changes or additions. Send a message |
| 185 | to the `Zephyr-devel mailing list`_ to introduce and discuss your idea with |
| 186 | the development community. |
| 187 | |
Marti Bolivar | 1948f8b | 2017-11-13 09:51:14 -0500 | [diff] [blame] | 188 | Please note that it's common practice on IRC to be away from the |
| 189 | channel, but still have a client logged in to receive traffic. If you |
| 190 | ask a question to a particular person and they don't answer, **try |
| 191 | to stay signed in to the channel** if you can, so they have time to |
| 192 | respond to you. This is especially important given the many different |
| 193 | timezones Zephyr developers live in. If you don't get a timely |
| 194 | response on IRC, try sending a message to the mailing list instead. |
| 195 | |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 196 | It's always a good practice to search for existing or related issues before |
| 197 | submitting your own. When you submit an issue (bug or feature request), the |
| 198 | triage team will review and comment on the submission, typically within a few |
| 199 | business days. |
| 200 | |
| 201 | You can find all `open pull requests`_ on GitHub and open `Zephyr Project |
Anas Nashif | 37b9ee0 | 2017-10-02 22:33:16 -0400 | [diff] [blame] | 202 | Issues`_ in Github issues. |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 203 | |
| 204 | Development Tools and Git Setup |
| 205 | ******************************* |
| 206 | |
| 207 | Signed-off-by |
| 208 | ============= |
| 209 | |
| 210 | The name in the commit message ``Signed-off-by:`` line and your email must |
| 211 | match the change authorship information. Make sure your *.git/config* is set |
| 212 | up correctly:: |
| 213 | |
| 214 | $ git config --global user.name "David Developer" |
| 215 | $ git config --global user.email "david.developer@company.com" |
| 216 | |
| 217 | gitlint |
| 218 | ========= |
| 219 | |
| 220 | When you submit a pull request to the project, a series of checks are |
| 221 | performed to verify your commit messages meet the requirements. The same step |
| 222 | done during the CI process can be performed locally using the the *gitlint* |
| 223 | command. |
| 224 | |
| 225 | Install gitlint and run it locally in your tree and branch where your patches |
| 226 | have been committed:: |
| 227 | |
| 228 | $ sudo pip3 install gitlint |
| 229 | $ gitlint |
| 230 | |
| 231 | Note, gitlint only checks HEAD (the most recent commit), so you should run it |
| 232 | after each commit, or use the ``--commits`` option to specify a commit range |
| 233 | covering all the development patches to be submitted. |
| 234 | |
| 235 | sanitycheck |
| 236 | =========== |
| 237 | |
| 238 | To verify that your changes did not break any tests or samples, please run the |
| 239 | ``sanitycheck`` script locally before submitting your pull request to GitHub. To |
| 240 | run the same tests the CI system runs, follow these steps from within your |
| 241 | local Zephyr source working directory:: |
| 242 | |
| 243 | $ source zephyr-env.sh |
Sebastian Bøe | 7cc2071 | 2017-11-09 12:32:56 +0100 | [diff] [blame] | 244 | $ ./scripts/sanitycheck |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 245 | |
| 246 | The above will execute the basic sanitycheck script, which will run various |
| 247 | kernel tests using the QEMU emulator. It will also do some build tests on |
| 248 | various samples with advanced features that can't run in QEMU. |
| 249 | |
Anas Nashif | 602a143 | 2017-10-31 08:35:24 -0400 | [diff] [blame] | 250 | We highly recommend you run these tests locally to avoid any CI |
Sebastian Bøe | 7cc2071 | 2017-11-09 12:32:56 +0100 | [diff] [blame] | 251 | failures. |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 252 | |
| 253 | |
| 254 | Coding Style |
| 255 | ************ |
| 256 | |
| 257 | Use these coding guidelines to ensure that your development complies with the |
| 258 | project's style and naming conventions. |
| 259 | |
| 260 | .. _Linux kernel coding style: |
| 261 | https://kernel.org/doc/html/latest/process/coding-style.html |
| 262 | |
| 263 | |
| 264 | In general, follow the `Linux kernel coding style`_, with the |
| 265 | following exceptions: |
| 266 | |
| 267 | * Add braces to every ``if`` and ``else`` body, even for single-line code |
| 268 | blocks. Use the ``--ignore BRACES`` flag to make *checkpatch* stop |
| 269 | complaining. |
| 270 | * Use spaces instead of tabs to align comments after declarations, as needed. |
| 271 | * Use C89-style single line comments, ``/* */``. The C99-style single line |
| 272 | comment, ``//``, is not allowed. |
| 273 | * Use ``/** */`` for doxygen comments that need to appear in the documentation. |
| 274 | |
| 275 | The Linux kernel GPL-licensed tool ``checkpatch`` is used to check coding |
| 276 | style conformity. Checkpatch is available in the scripts directory. To invoke |
| 277 | it when committing code, edit your *.git/hooks/pre-commit* file to contain: |
| 278 | |
Anas Nashif | 454d0af | 2017-08-01 15:03:17 -0400 | [diff] [blame] | 279 | .. code-block:: bash |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 280 | |
| 281 | #!/bin/sh |
| 282 | set -e exec |
| 283 | exec git diff --cached | ${ZEPHYR_BASE}/scripts/checkpatch.pl - || true |
| 284 | |
David B. Kinder | 10b24a8 | 2017-09-19 17:23:35 -0700 | [diff] [blame] | 285 | .. _Contribution workflow: |
| 286 | |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 287 | Contribution Workflow |
| 288 | ********************* |
| 289 | |
| 290 | One general practice we encourage, is to make small, |
| 291 | controlled changes. This practice simplifies review, makes merging and |
| 292 | rebasing easier, and keeps the change history clear and clean. |
| 293 | |
| 294 | When contributing to the Zephyr Project, it is also important you provide as much |
| 295 | information as you can about your change, update appropriate documentation, |
| 296 | and test your changes thoroughly before submitting. |
| 297 | |
| 298 | The general GitHub workflow used by Zephyr developers uses a combination of |
| 299 | command line Git commands and browser interaction with GitHub. As it is with |
| 300 | Git, there are multiple ways of getting a task done. We'll describe a typical |
| 301 | workflow here: |
| 302 | |
| 303 | .. _Create a Fork of Zephyr: |
| 304 | https://github.com/zephyrproject-rtos/zephyr#fork-destination-box |
| 305 | |
| 306 | #. `Create a Fork of Zephyr`_ |
| 307 | to your personal account on GitHub. (Click on the fork button in the top |
| 308 | right corner of the Zephyr project repo page in GitHub.) |
| 309 | |
| 310 | #. On your development computer, clone the fork you just made:: |
| 311 | |
| 312 | $ git clone https://github.com/<your github id>/zephyr |
| 313 | |
| 314 | This would be a good time to let Git know about the upstream repo too:: |
| 315 | |
| 316 | $ git remote add upstream https://github.com/zephyrproject-rtos/zephyr.git |
| 317 | |
| 318 | and verify the remote repos:: |
| 319 | |
| 320 | $ git remote -v |
| 321 | |
| 322 | #. Create a topic branch (off of master) for your work (if you're addressing |
Anas Nashif | 37b9ee0 | 2017-10-02 22:33:16 -0400 | [diff] [blame] | 323 | an issue, we suggest including the issue number in the branch name):: |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 324 | |
| 325 | $ git checkout master |
| 326 | $ git checkout -b fix_comment_typo |
| 327 | |
| 328 | Some Zephyr subsystems do development work on a separate branch from |
| 329 | master so you may need to indicate this in your checkout:: |
| 330 | |
| 331 | $ git checkout -b fix_out_of_date_patch origin/net |
| 332 | |
| 333 | #. Make changes, test locally, change, test, test again, ... (Check out the |
| 334 | prior chapter on `sanitycheck`_ as well). |
| 335 | |
| 336 | #. When things look good, start the pull request process by adding your changed |
| 337 | files:: |
| 338 | |
| 339 | $ git add [file(s) that changed, add -p if you want to be more specific] |
| 340 | |
| 341 | You can see files that are not yet staged using:: |
| 342 | |
| 343 | $ git status |
| 344 | |
| 345 | #. Verify changes to be committed look as you expected:: |
| 346 | |
| 347 | $ git diff --cached |
| 348 | |
| 349 | #. Commit your changes to your local repo:: |
| 350 | |
| 351 | $ git commit -s |
| 352 | |
| 353 | The ``-s`` option automatically adds your ``Signed-off-by:`` to your commit |
| 354 | message. Your commit will be rejected without this line that indicates your |
| 355 | agreement with the `DCO`_. See the `Commit Guidelines`_ section for |
| 356 | specific guidelines for writing your commit messages. |
| 357 | |
| 358 | #. Push your topic branch with your changes to your fork in your personal |
| 359 | GitHub account:: |
| 360 | |
| 361 | $ git push origin fix_comment_typo |
| 362 | |
| 363 | #. In your web browser, go to your forked repo and click on the |
| 364 | ``Compare & pull request`` button for the branch you just worked on and |
| 365 | you want to open a pull request with. |
| 366 | |
| 367 | #. Review the pull request changes, and verify that you are opening a |
| 368 | pull request for the appropriate branch. The title and message from your |
| 369 | commit message should appear as well. |
| 370 | |
| 371 | #. If you're working on a subsystem branch that's not ``master``, |
| 372 | you may need to change the intended branch for the pull request |
| 373 | here, for example, by changing the base branch from ``master`` to ``net``. |
| 374 | |
| 375 | #. GitHub will assign one or more suggested reviewers (based on the |
| 376 | CODEOWNERS file in the repo). If you are a project member, you can |
| 377 | select additional reviewers now too. |
| 378 | |
| 379 | #. Click on the submit button and your pull request is sent and awaits |
| 380 | review. Email will be sent as review comments are made, or you can check |
| 381 | on your pull request at https://github.com/zephyrproject-rtos/zephyr/pulls. |
| 382 | |
| 383 | #. While you're waiting for your pull request to be accepted and merged, you |
| 384 | can create another branch to work on another issue. (Be sure to make your |
| 385 | new branch off of master and not the previous branch.):: |
| 386 | |
| 387 | $ git checkout master |
| 388 | $ git checkout -b fix_another_issue |
| 389 | |
| 390 | and use the same process described above to work on this new topic branch. |
| 391 | |
| 392 | #. If reviewers do request changes to your patch, you can interactively rebase |
| 393 | commit(s) to fix review issues. In your development repo:: |
| 394 | |
| 395 | $ git fetch --all |
| 396 | $ git rebase --ignore-whitespace upstream/master |
| 397 | |
| 398 | The ``--ignore-whitespace`` option stops ``git apply`` (called by rebase) |
| 399 | from changing any whitespace. Continuing:: |
| 400 | |
| 401 | $ git rebase -i <offending-commit-id>^ |
| 402 | |
| 403 | In the interactive rebase editor, replace ``pick`` with ``edit`` to select |
| 404 | a specific commit (if there's more than one in your pull request), or |
| 405 | remove the line to delete a commit entirely. Then edit files to fix the |
| 406 | issues in the review. |
| 407 | |
| 408 | As before, inspect and test your changes. When ready, continue the |
| 409 | patch submission:: |
| 410 | |
| 411 | $ git add [file(s)] |
| 412 | $ git rebase --continue |
| 413 | |
| 414 | Update commit comment if needed, and continue:: |
| 415 | |
| 416 | $ git push --force origin fix_comment_typo |
| 417 | |
| 418 | By force pushing your update, your original pull request will be updated |
| 419 | with your changes so you won't need to resubmit the pull request. |
| 420 | |
| 421 | |
| 422 | Commit Guidelines |
| 423 | ***************** |
| 424 | |
| 425 | Changes are submitted as Git commits. Each commit message must contain: |
| 426 | |
| 427 | * A short and descriptive subject line that is less than 72 characters, |
| 428 | followed by a blank line. The subject line must include a prefix that |
| 429 | identifies the subsystem being changed, followed by a colon, and a short |
| 430 | title, for example: ``doc: update wiki references to new site``. |
| 431 | (If you're updating an existing file, you can use |
| 432 | ``git log <filename>`` to see what developers used as the prefix for |
| 433 | previous patches of this file.) |
| 434 | |
| 435 | * A change description with your logic or reasoning for the changes, followed |
| 436 | by a blank line. |
| 437 | |
| 438 | * A Signed-off-by line, ``Signed-off-by: <name> <email>`` typically added |
| 439 | automatically by using ``git commit -s`` |
| 440 | |
Anas Nashif | 37b9ee0 | 2017-10-02 22:33:16 -0400 | [diff] [blame] | 441 | * If the change addresses an issue, include a line of the form:: |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 442 | |
Anas Nashif | 37b9ee0 | 2017-10-02 22:33:16 -0400 | [diff] [blame] | 443 | Fixes #<issue number>. |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 444 | |
| 445 | |
| 446 | All changes and topics sent to GitHub must be well-formed, as described above. |
| 447 | |
| 448 | Commit Message Body |
| 449 | =================== |
| 450 | |
| 451 | When editing the commit message, please briefly explain what your change |
| 452 | does and why it's needed. A change summary of ``"Fixes stuff"`` will be rejected. An |
| 453 | empty change summary is only acceptable for trivial changes fully described by |
| 454 | the commit title (e.g., ``doc: fix misspellings in CONTRIBUTING doc``) |
| 455 | |
| 456 | The description body of the commit message must include: |
| 457 | |
| 458 | * **what** the change does, |
| 459 | * **why** you chose that approach, |
| 460 | * **what** assumptions were made, and |
| 461 | * **how** you know it works -- for example, which tests you ran. |
| 462 | |
| 463 | For examples of accepted commit messages, you can refer to the Zephyr GitHub |
| 464 | `changelog <https://github.com/zephyrproject-rtos/zephyr/commits/master>`__. |
| 465 | |
| 466 | Other Commit Expectations |
| 467 | ========================= |
| 468 | |
| 469 | * Commits must build cleanly when applied on top of each other, thus avoiding |
| 470 | breaking bisectability. |
| 471 | |
| 472 | * Commits must pass the *scripts/checkpatch.pl* requirements. |
| 473 | |
| 474 | * Each commit must address a single identifiable issue and must be |
| 475 | logically self-contained. Unrelated changes should be submitted as |
| 476 | separate commits. |
| 477 | |
| 478 | * You may submit pull request RFCs (requests for comments) to send work |
| 479 | proposals, progress snapshots of your work, or to get early feedback on |
| 480 | features or changes that will affect multiple areas in the code base. |
| 481 | |
| 482 | Identifying Contribution Origin |
| 483 | =============================== |
| 484 | |
| 485 | When adding a new file to the tree, it is important to detail the source of |
| 486 | origin on the file, provide attributions, and detail the intended usage. In |
| 487 | cases where the file is an original to Zephyr, the commit message should |
| 488 | include the following ("Original" is the assumption if no Origin tag is |
| 489 | present):: |
| 490 | |
| 491 | Origin: Original |
| 492 | |
| 493 | In cases where the file is imported from an external project, the commit |
| 494 | message shall contain details regarding the original project, the location of |
| 495 | the project, the SHA-id of the origin commit for the file, the intended |
| 496 | purpose, and if the file will be maintained by the Zephyr project, |
| 497 | (whether or not the Zephyr project will contain a localized branch or if |
| 498 | it is a downstream copy). |
| 499 | |
| 500 | For example, a copy of a locally maintained import:: |
| 501 | |
| 502 | Origin: Contiki OS |
Anas Nashif | 788ca64 | 2017-08-03 09:30:38 -0400 | [diff] [blame] | 503 | License: BSD 3-Clause |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 504 | URL: http://www.contiki-os.org/ |
| 505 | commit: 853207acfdc6549b10eb3e44504b1a75ae1ad63a |
| 506 | Purpose: Introduction of networking stack. |
| 507 | Maintained-by: Zephyr |
| 508 | |
| 509 | For example, a copy of an externally maintained import:: |
| 510 | |
| 511 | Origin: Tiny Crypt |
Anas Nashif | 788ca64 | 2017-08-03 09:30:38 -0400 | [diff] [blame] | 512 | License: BSD 3-Clause |
David B. Kinder | 2d4728d | 2017-07-27 17:04:04 -0700 | [diff] [blame] | 513 | URL: https://github.com/01org/tinycrypt |
| 514 | commit: 08ded7f21529c39e5133688ffb93a9d0c94e5c6e |
| 515 | Purpose: Introduction of TinyCrypt |
| 516 | Maintained-by: External |