18aa05055SPaul BeesleyContributor's Guide 28aa05055SPaul Beesley=================== 340d553cfSPaul Beesley 440d553cfSPaul BeesleyGetting Started 540d553cfSPaul Beesley--------------- 640d553cfSPaul Beesley 73d28b0a4SSandrine Bailleux- Make sure you have a Github account and you are logged on both 83d28b0a4SSandrine Bailleux `developer.trustedfirmware.org`_ and `review.trustedfirmware.org`_. 940d553cfSPaul Beesley 10a88b3c29SSandrine Bailleux- If you plan to contribute a major piece of work, it is usually a good idea to 11a88b3c29SSandrine Bailleux start a discussion around it on the mailing list. This gives everyone 12a88b3c29SSandrine Bailleux visibility of what is coming up, you might learn that somebody else is 13a88b3c29SSandrine Bailleux already working on something similar or the community might be able to 14a88b3c29SSandrine Bailleux provide some early input to help shaping the design of the feature. 15a88b3c29SSandrine Bailleux 16a88b3c29SSandrine Bailleux If you intend to include Third Party IP in your contribution, please mention 17a88b3c29SSandrine Bailleux it explicitly in the email thread and ensure that the changes that include 18a88b3c29SSandrine Bailleux Third Party IP are made in a separate patch (or patch series). 1940d553cfSPaul Beesley 2043f35ef5SPaul Beesley- Clone `Trusted Firmware-A`_ on your own machine as described in 2143f35ef5SPaul Beesley :ref:`prerequisites_get_source`. 22e256cc63SSandrine Bailleux 23f6ad51c8SJohn Tsichritzis- Create a local topic branch based on the `Trusted Firmware-A`_ ``master`` 2440d553cfSPaul Beesley branch. 2540d553cfSPaul Beesley 2640d553cfSPaul BeesleyMaking Changes 2740d553cfSPaul Beesley-------------- 2840d553cfSPaul Beesley 2940d553cfSPaul Beesley- Make commits of logical units. See these general `Git guidelines`_ for 3040d553cfSPaul Beesley contributing to a project. 31e256cc63SSandrine Bailleux 3240d553cfSPaul Beesley- Keep the commits on topic. If you need to fix another bug or make another 33a88b3c29SSandrine Bailleux enhancement, please address it on a separate topic branch. 34e256cc63SSandrine Bailleux 357969747eSSandrine Bailleux- Split the patch in manageable units. Small patches are usually easier to 367969747eSSandrine Bailleux review so this will speed up the review process. 377969747eSSandrine Bailleux 3840d553cfSPaul Beesley- Avoid long commit series. If you do have a long series, consider whether 3940d553cfSPaul Beesley some commits should be squashed together or addressed in a separate topic. 40e256cc63SSandrine Bailleux 417969747eSSandrine Bailleux- Ensure that each commit in the series has at least one ``Signed-off-by:`` 427969747eSSandrine Bailleux line, using your real name and email address. The names in the 437969747eSSandrine Bailleux ``Signed-off-by:`` and ``Commit:`` lines must match. By adding this line the 447969747eSSandrine Bailleux contributor certifies the contribution is made under the terms of the 457969747eSSandrine Bailleux :download:`Developer Certificate of Origin <../../dco.txt>`. 467969747eSSandrine Bailleux 477969747eSSandrine Bailleux There might be multiple ``Signed-off-by:`` lines, depending on the history 487969747eSSandrine Bailleux of the patch. 497969747eSSandrine Bailleux 507969747eSSandrine Bailleux More details may be found in the `Gerrit Signed-off-by Lines guidelines`_. 517969747eSSandrine Bailleux 527969747eSSandrine Bailleux- Ensure that each commit also has a unique ``Change-Id:`` line. If you have 537969747eSSandrine Bailleux cloned the repository with the "`Clone with commit-msg hook`" clone method 547969747eSSandrine Bailleux (following the :ref:`Prerequisites` document), this should already be the 557969747eSSandrine Bailleux case. 567969747eSSandrine Bailleux 577969747eSSandrine Bailleux More details may be found in the `Gerrit Change-Ids documentation`_. 587969747eSSandrine Bailleux 597969747eSSandrine Bailleux- Write informative and comprehensive commit messages. A good commit message 607969747eSSandrine Bailleux provides all the background information needed for reviewers to understand 617969747eSSandrine Bailleux the intent and rationale of the patch. This information is also useful for 627969747eSSandrine Bailleux future reference. 637969747eSSandrine Bailleux 647969747eSSandrine Bailleux For example: 657969747eSSandrine Bailleux 667969747eSSandrine Bailleux - What does the patch do? 677969747eSSandrine Bailleux - What motivated it? 687969747eSSandrine Bailleux - What impact does it have? 697969747eSSandrine Bailleux - How was it tested? 707969747eSSandrine Bailleux - Have alternatives been considered? Why did you choose this approach over 717969747eSSandrine Bailleux another one? 727969747eSSandrine Bailleux - If it fixes an `issue`_, include a reference. 737969747eSSandrine Bailleux 747969747eSSandrine Bailleux- Follow the :ref:`Coding Style` and :ref:`Coding Guidelines`. 757969747eSSandrine Bailleux 767969747eSSandrine Bailleux - Use the checkpatch.pl script provided with the Linux source tree. A 777969747eSSandrine Bailleux Makefile target is provided for convenience, see :ref:`this 787969747eSSandrine Bailleux section<automatic-compliance-checking>` for more details. 79e256cc63SSandrine Bailleux 8040d553cfSPaul Beesley- Where appropriate, please update the documentation. 8140d553cfSPaul Beesley 82e256cc63SSandrine Bailleux - Consider whether the :ref:`Porting Guide`, :ref:`Firmware Design` document 83e256cc63SSandrine Bailleux or other in-source documentation needs updating. 84e256cc63SSandrine Bailleux 85e256cc63SSandrine Bailleux - If you are submitting new files that you intend to be the code owner for 86e256cc63SSandrine Bailleux (for example, a new platform port), then also update the 87e256cc63SSandrine Bailleux :ref:`code owners` file. 88e256cc63SSandrine Bailleux 89e256cc63SSandrine Bailleux - For topics with multiple commits, you should make all documentation changes 90e256cc63SSandrine Bailleux (and nothing else) in the last commit of the series. Otherwise, include 91e256cc63SSandrine Bailleux the documentation changes within the single commit. 92e256cc63SSandrine Bailleux 93*1f19411aSSandrine Bailleux.. _copyright-license-guidance: 94*1f19411aSSandrine Bailleux 9540d553cfSPaul Beesley- Ensure that each changed file has the correct copyright and license 96e256cc63SSandrine Bailleux information. Files that entirely consist of contributions to this project 97e256cc63SSandrine Bailleux should have a copyright notice and BSD-3-Clause SPDX license identifier of 98e256cc63SSandrine Bailleux the form as shown in :ref:`license`. Files that contain changes to imported 99e256cc63SSandrine Bailleux Third Party IP files should retain their original copyright and license 100e256cc63SSandrine Bailleux notices. 101e256cc63SSandrine Bailleux 102e256cc63SSandrine Bailleux For significant contributions you may add your own copyright notice in the 103e256cc63SSandrine Bailleux following format: 10440d553cfSPaul Beesley 10540d553cfSPaul Beesley :: 10640d553cfSPaul Beesley 10740d553cfSPaul Beesley Portions copyright (c) [XXXX-]YYYY, <OWNER>. All rights reserved. 10840d553cfSPaul Beesley 109e256cc63SSandrine Bailleux where XXXX is the year of first contribution (if different to YYYY) and YYYY 110e256cc63SSandrine Bailleux is the year of most recent contribution. <OWNER> is your name or your company 111e256cc63SSandrine Bailleux name. 11240d553cfSPaul Beesley 1137969747eSSandrine Bailleux- Ensure that each patch in the patch series compiles in all supported 1147969747eSSandrine Bailleux configurations. Patches which do not compile will not be merged. 1157969747eSSandrine Bailleux 11640d553cfSPaul Beesley- Please test your changes. As a minimum, ensure that Linux boots on the 11743f35ef5SPaul Beesley Foundation FVP. See :ref:`Arm Fixed Virtual Platforms (FVP)` for more 11843f35ef5SPaul Beesley information. For more extensive testing, consider running the `TF-A Tests`_ 11943f35ef5SPaul Beesley against your patches. 12040d553cfSPaul Beesley 1217969747eSSandrine Bailleux- Ensure that all CI automated tests pass. Failures should be fixed. They might 1227969747eSSandrine Bailleux block a patch, depending on how critical they are. 1237969747eSSandrine Bailleux 12440d553cfSPaul BeesleySubmitting Changes 12540d553cfSPaul Beesley------------------ 12640d553cfSPaul Beesley 12740d553cfSPaul Beesley- Submit your changes for review at https://review.trustedfirmware.org 12840d553cfSPaul Beesley targeting the ``integration`` branch. 12940d553cfSPaul Beesley 1307969747eSSandrine Bailleux- Add reviewers for your patch: 1317969747eSSandrine Bailleux 1327969747eSSandrine Bailleux - At least one code owner for each module modified by the patch. See the list 1337969747eSSandrine Bailleux of modules and their :ref:`code owners`. 1347969747eSSandrine Bailleux 1357969747eSSandrine Bailleux - At least one maintainer. See the list of :ref:`maintainers`. 1367969747eSSandrine Bailleux 1377969747eSSandrine Bailleux - If some module has no code owner, try to identify a suitable (non-code 1387969747eSSandrine Bailleux owner) reviewer. Running ``git blame`` on the module's source code can 1397969747eSSandrine Bailleux help, as it shows who has been working the most recently on this area of 1407969747eSSandrine Bailleux the code. 1417969747eSSandrine Bailleux 1427969747eSSandrine Bailleux Alternatively, if it is impractical to identify such a reviewer, you might 1437969747eSSandrine Bailleux send an email to the `TF-A mailing list`_ to broadcast your review request 1447969747eSSandrine Bailleux to the community. 1457969747eSSandrine Bailleux 1467969747eSSandrine Bailleux Note that self-reviewing a patch is prohibited, even if the patch author is 1477969747eSSandrine Bailleux the only code owner of a module modified by the patch. Getting a second pair 1487969747eSSandrine Bailleux of eyes on the code is essential to keep up with the quality standards the 1497969747eSSandrine Bailleux project aspires to. 1507969747eSSandrine Bailleux 1517969747eSSandrine Bailleux- The changes will then undergo further review by the designated people. Any 1527969747eSSandrine Bailleux review comments will be made directly on your patch. This may require you to 1537969747eSSandrine Bailleux do some rework. For controversial changes, the discussion might be moved to 1547969747eSSandrine Bailleux the `TF-A mailing list`_ to involve more of the community. 15540d553cfSPaul Beesley 15640d553cfSPaul Beesley Refer to the `Gerrit Uploading Changes documentation`_ for more details. 15740d553cfSPaul Beesley 1587969747eSSandrine Bailleux- The patch submission rules are the following. For a patch to be approved 1597969747eSSandrine Bailleux and merged in the tree, it must get: 1607969747eSSandrine Bailleux 1617969747eSSandrine Bailleux - One ``Code-Owner-Review+1`` for each of the modules modified by the patch. 1627969747eSSandrine Bailleux - A ``Maintainer-Review+1``. 1637969747eSSandrine Bailleux 1647969747eSSandrine Bailleux In the case where a code owner could not be found for a given module, 1657969747eSSandrine Bailleux ``Code-Owner-Review+1`` is substituted by ``Code-Review+1``. 1667969747eSSandrine Bailleux 1677969747eSSandrine Bailleux In addition to these various code review labels, the patch must also get a 1687969747eSSandrine Bailleux ``Verified+1``. This is usually set by the Continuous Integration (CI) bot 1697969747eSSandrine Bailleux when all automated tests passed on the patch. Sometimes, some of these 1707969747eSSandrine Bailleux automated tests may fail for reasons unrelated to the patch. In this case, 1717969747eSSandrine Bailleux the maintainers might (after analysis of the failures) override the CI bot 1727969747eSSandrine Bailleux score to certify that the patch has been correctly tested. 1737969747eSSandrine Bailleux 1747969747eSSandrine Bailleux In the event where the CI system lacks proper tests for a patch, the patch 1757969747eSSandrine Bailleux author or a reviewer might agree to perform additional manual tests 1767969747eSSandrine Bailleux in their review and the reviewer incorporates the review of the additional 1777969747eSSandrine Bailleux testing in the ``Code-Review+1`` or ``Code-Owner-Review+1`` as applicable to 1787969747eSSandrine Bailleux attest that the patch works as expected. Where possible additional tests should 1797969747eSSandrine Bailleux be added to the CI system as a follow up task. For example, for a 1807969747eSSandrine Bailleux platform-dependent patch where the said platform is not available in the CI 1817969747eSSandrine Bailleux system's board farm. 1827969747eSSandrine Bailleux 18334760951SPaul Beesley- When the changes are accepted, the :ref:`maintainers` will integrate them. 18440d553cfSPaul Beesley 18534760951SPaul Beesley - Typically, the :ref:`maintainers` will merge the changes into the 18640d553cfSPaul Beesley ``integration`` branch. 1877969747eSSandrine Bailleux 18840d553cfSPaul Beesley - If the changes are not based on a sufficiently-recent commit, or if they 18934760951SPaul Beesley cannot be automatically rebased, then the :ref:`maintainers` may rebase it 1903d28b0a4SSandrine Bailleux on the ``integration`` branch or ask you to do so. 1917969747eSSandrine Bailleux 19240d553cfSPaul Beesley - After final integration testing, the changes will make their way into the 1933d28b0a4SSandrine Bailleux ``master`` branch. If a problem is found during integration, the 1943d28b0a4SSandrine Bailleux :ref:`maintainers` will request your help to solve the issue. They may 1953d28b0a4SSandrine Bailleux revert your patches and ask you to resubmit a reworked version of them or 1963d28b0a4SSandrine Bailleux they may ask you to provide a fix-up patch. 19740d553cfSPaul Beesley 19840d553cfSPaul BeesleyBinary Components 19940d553cfSPaul Beesley----------------- 20040d553cfSPaul Beesley 20140d553cfSPaul Beesley- Platforms may depend on binary components submitted to the `Trusted Firmware 20240d553cfSPaul Beesley binary repository`_ if they require code that the contributor is unable or 20340d553cfSPaul Beesley unwilling to open-source. This should be used as a rare exception. 20440d553cfSPaul Beesley- All binary components must follow the contribution guidelines (in particular 20540d553cfSPaul Beesley licensing rules) outlined in the `readme.rst <tf-binaries-readme_>`_ file of 20640d553cfSPaul Beesley the binary repository. 20740d553cfSPaul Beesley- Binary components must be restricted to only the specific functionality that 20840d553cfSPaul Beesley cannot be open-sourced and must be linked into a larger open-source platform 20940d553cfSPaul Beesley port. The majority of the platform port must still be implemented in open 21040d553cfSPaul Beesley source. Platform ports that are merely a thin wrapper around a binary 21140d553cfSPaul Beesley component that contains all the actual code will not be accepted. 21240d553cfSPaul Beesley- Only platform port code (i.e. in the ``plat/<vendor>`` directory) may rely on 21340d553cfSPaul Beesley binary components. Generic code must always be fully open-source. 21440d553cfSPaul Beesley 21540d553cfSPaul Beesley-------------- 21640d553cfSPaul Beesley 217e63f5d12SPaul Beesley*Copyright (c) 2013-2020, Arm Limited and Contributors. All rights reserved.* 21840d553cfSPaul Beesley 21940d553cfSPaul Beesley.. _developer.trustedfirmware.org: https://developer.trustedfirmware.org 2203d28b0a4SSandrine Bailleux.. _review.trustedfirmware.org: https://review.trustedfirmware.org 22140d553cfSPaul Beesley.. _issue: https://developer.trustedfirmware.org/project/board/1/ 222f6ad51c8SJohn Tsichritzis.. _Trusted Firmware-A: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git 22340d553cfSPaul Beesley.. _Git guidelines: http://git-scm.com/book/ch5-2.html 22440d553cfSPaul Beesley.. _Gerrit Uploading Changes documentation: https://review.trustedfirmware.org/Documentation/user-upload.html 22540d553cfSPaul Beesley.. _Gerrit Signed-off-by Lines guidelines: https://review.trustedfirmware.org/Documentation/user-signedoffby.html 22640d553cfSPaul Beesley.. _Gerrit Change-Ids documentation: https://review.trustedfirmware.org/Documentation/user-changeid.html 2273d28b0a4SSandrine Bailleux.. _TF-A Tests: https://trustedfirmware-a-tests.readthedocs.io 22840d553cfSPaul Beesley.. _Trusted Firmware binary repository: https://review.trustedfirmware.org/admin/repos/tf-binaries 22940d553cfSPaul Beesley.. _tf-binaries-readme: https://git.trustedfirmware.org/tf-binaries.git/tree/readme.rst 2303d28b0a4SSandrine Bailleux.. _TF-A mailing list: https://lists.trustedfirmware.org/mailman/listinfo/tf-a 231