xref: /rk3399_ARM-atf/docs/process/contributing.rst (revision 7969747e7f7819b6c66977d85b776c0a9a169c1b)
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
35*7969747eSSandrine Bailleux-  Split the patch in manageable units. Small patches are usually easier to
36*7969747eSSandrine Bailleux   review so this will speed up the review process.
37*7969747eSSandrine 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
41*7969747eSSandrine Bailleux-  Ensure that each commit in the series has at least one ``Signed-off-by:``
42*7969747eSSandrine Bailleux   line, using your real name and email address. The names in the
43*7969747eSSandrine Bailleux   ``Signed-off-by:`` and ``Commit:`` lines must match. By adding this line the
44*7969747eSSandrine Bailleux   contributor certifies the contribution is made under the terms of the
45*7969747eSSandrine Bailleux   :download:`Developer Certificate of Origin <../../dco.txt>`.
46*7969747eSSandrine Bailleux
47*7969747eSSandrine Bailleux   There might be multiple ``Signed-off-by:`` lines, depending on the history
48*7969747eSSandrine Bailleux   of the patch.
49*7969747eSSandrine Bailleux
50*7969747eSSandrine Bailleux   More details may be found in the `Gerrit Signed-off-by Lines guidelines`_.
51*7969747eSSandrine Bailleux
52*7969747eSSandrine Bailleux-  Ensure that each commit also has a unique ``Change-Id:`` line. If you have
53*7969747eSSandrine Bailleux   cloned the repository with the "`Clone with commit-msg hook`" clone method
54*7969747eSSandrine Bailleux   (following the :ref:`Prerequisites` document), this should already be the
55*7969747eSSandrine Bailleux   case.
56*7969747eSSandrine Bailleux
57*7969747eSSandrine Bailleux   More details may be found in the `Gerrit Change-Ids documentation`_.
58*7969747eSSandrine Bailleux
59*7969747eSSandrine Bailleux-  Write informative and comprehensive commit messages. A good commit message
60*7969747eSSandrine Bailleux   provides all the background information needed for reviewers to understand
61*7969747eSSandrine Bailleux   the intent and rationale of the patch. This information is also useful for
62*7969747eSSandrine Bailleux   future reference.
63*7969747eSSandrine Bailleux
64*7969747eSSandrine Bailleux   For example:
65*7969747eSSandrine Bailleux
66*7969747eSSandrine Bailleux   -  What does the patch do?
67*7969747eSSandrine Bailleux   -  What motivated it?
68*7969747eSSandrine Bailleux   -  What impact does it have?
69*7969747eSSandrine Bailleux   -  How was it tested?
70*7969747eSSandrine Bailleux   -  Have alternatives been considered? Why did you choose this approach over
71*7969747eSSandrine Bailleux      another one?
72*7969747eSSandrine Bailleux   -  If it fixes an `issue`_, include a reference.
73*7969747eSSandrine Bailleux
74*7969747eSSandrine Bailleux-  Follow the :ref:`Coding Style` and :ref:`Coding Guidelines`.
75*7969747eSSandrine Bailleux
76*7969747eSSandrine Bailleux   -  Use the checkpatch.pl script provided with the Linux source tree. A
77*7969747eSSandrine Bailleux      Makefile target is provided for convenience, see :ref:`this
78*7969747eSSandrine 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
9340d553cfSPaul Beesley-  Ensure that each changed file has the correct copyright and license
94e256cc63SSandrine Bailleux   information. Files that entirely consist of contributions to this project
95e256cc63SSandrine Bailleux   should have a copyright notice and BSD-3-Clause SPDX license identifier of
96e256cc63SSandrine Bailleux   the form as shown in :ref:`license`. Files that contain changes to imported
97e256cc63SSandrine Bailleux   Third Party IP files should retain their original copyright and license
98e256cc63SSandrine Bailleux   notices.
99e256cc63SSandrine Bailleux
100e256cc63SSandrine Bailleux   For significant contributions you may add your own copyright notice in the
101e256cc63SSandrine Bailleux   following format:
10240d553cfSPaul Beesley
10340d553cfSPaul Beesley   ::
10440d553cfSPaul Beesley
10540d553cfSPaul Beesley       Portions copyright (c) [XXXX-]YYYY, <OWNER>. All rights reserved.
10640d553cfSPaul Beesley
107e256cc63SSandrine Bailleux   where XXXX is the year of first contribution (if different to YYYY) and YYYY
108e256cc63SSandrine Bailleux   is the year of most recent contribution. <OWNER> is your name or your company
109e256cc63SSandrine Bailleux   name.
11040d553cfSPaul Beesley
111*7969747eSSandrine Bailleux-  Ensure that each patch in the patch series compiles in all supported
112*7969747eSSandrine Bailleux   configurations. Patches which do not compile will not be merged.
113*7969747eSSandrine Bailleux
11440d553cfSPaul Beesley-  Please test your changes. As a minimum, ensure that Linux boots on the
11543f35ef5SPaul Beesley   Foundation FVP. See :ref:`Arm Fixed Virtual Platforms (FVP)` for more
11643f35ef5SPaul Beesley   information. For more extensive testing, consider running the `TF-A Tests`_
11743f35ef5SPaul Beesley   against your patches.
11840d553cfSPaul Beesley
119*7969747eSSandrine Bailleux-  Ensure that all CI automated tests pass. Failures should be fixed. They might
120*7969747eSSandrine Bailleux   block a patch, depending on how critical they are.
121*7969747eSSandrine Bailleux
12240d553cfSPaul BeesleySubmitting Changes
12340d553cfSPaul Beesley------------------
12440d553cfSPaul Beesley
12540d553cfSPaul Beesley-  Submit your changes for review at https://review.trustedfirmware.org
12640d553cfSPaul Beesley   targeting the ``integration`` branch.
12740d553cfSPaul Beesley
128*7969747eSSandrine Bailleux-  Add reviewers for your patch:
129*7969747eSSandrine Bailleux
130*7969747eSSandrine Bailleux   -  At least one code owner for each module modified by the patch. See the list
131*7969747eSSandrine Bailleux      of modules and their :ref:`code owners`.
132*7969747eSSandrine Bailleux
133*7969747eSSandrine Bailleux   -  At least one maintainer. See the list of :ref:`maintainers`.
134*7969747eSSandrine Bailleux
135*7969747eSSandrine Bailleux   -  If some module has no code owner, try to identify a suitable (non-code
136*7969747eSSandrine Bailleux      owner) reviewer. Running ``git blame`` on the module's source code can
137*7969747eSSandrine Bailleux      help, as it shows who has been working the most recently on this area of
138*7969747eSSandrine Bailleux      the code.
139*7969747eSSandrine Bailleux
140*7969747eSSandrine Bailleux      Alternatively, if it is impractical to identify such a reviewer, you might
141*7969747eSSandrine Bailleux      send an email to the `TF-A mailing list`_ to broadcast your review request
142*7969747eSSandrine Bailleux      to the community.
143*7969747eSSandrine Bailleux
144*7969747eSSandrine Bailleux   Note that self-reviewing a patch is prohibited, even if the patch author is
145*7969747eSSandrine Bailleux   the only code owner of a module modified by the patch. Getting a second pair
146*7969747eSSandrine Bailleux   of eyes on the code is essential to keep up with the quality standards the
147*7969747eSSandrine Bailleux   project aspires to.
148*7969747eSSandrine Bailleux
149*7969747eSSandrine Bailleux-  The changes will then undergo further review by the designated people. Any
150*7969747eSSandrine Bailleux   review comments will be made directly on your patch. This may require you to
151*7969747eSSandrine Bailleux   do some rework. For controversial changes, the discussion might be moved to
152*7969747eSSandrine Bailleux   the `TF-A mailing list`_ to involve more of the community.
15340d553cfSPaul Beesley
15440d553cfSPaul Beesley   Refer to the `Gerrit Uploading Changes documentation`_ for more details.
15540d553cfSPaul Beesley
156*7969747eSSandrine Bailleux-  The patch submission rules are the following. For a patch to be approved
157*7969747eSSandrine Bailleux   and merged in the tree, it must get:
158*7969747eSSandrine Bailleux
159*7969747eSSandrine Bailleux   -  One ``Code-Owner-Review+1`` for each of the modules modified by the patch.
160*7969747eSSandrine Bailleux   -  A ``Maintainer-Review+1``.
161*7969747eSSandrine Bailleux
162*7969747eSSandrine Bailleux   In the case where a code owner could not be found for a given module,
163*7969747eSSandrine Bailleux   ``Code-Owner-Review+1`` is substituted by ``Code-Review+1``.
164*7969747eSSandrine Bailleux
165*7969747eSSandrine Bailleux   In addition to these various code review labels, the patch must also get a
166*7969747eSSandrine Bailleux   ``Verified+1``. This is usually set by the Continuous Integration (CI) bot
167*7969747eSSandrine Bailleux   when all automated tests passed on the patch. Sometimes, some of these
168*7969747eSSandrine Bailleux   automated tests may fail for reasons unrelated to the patch. In this case,
169*7969747eSSandrine Bailleux   the maintainers might (after analysis of the failures) override the CI bot
170*7969747eSSandrine Bailleux   score to certify that the patch has been correctly tested.
171*7969747eSSandrine Bailleux
172*7969747eSSandrine Bailleux   In the event where the CI system lacks proper tests for a patch, the patch
173*7969747eSSandrine Bailleux   author or a reviewer might agree to perform additional manual tests
174*7969747eSSandrine Bailleux   in their review and the reviewer incorporates the review of the additional
175*7969747eSSandrine Bailleux   testing in the ``Code-Review+1`` or ``Code-Owner-Review+1`` as applicable to
176*7969747eSSandrine Bailleux   attest that the patch works as expected. Where possible additional tests should
177*7969747eSSandrine Bailleux   be added to the CI system as a follow up task. For example, for a
178*7969747eSSandrine Bailleux   platform-dependent patch where the said platform is not available in the CI
179*7969747eSSandrine Bailleux   system's board farm.
180*7969747eSSandrine Bailleux
18134760951SPaul Beesley-  When the changes are accepted, the :ref:`maintainers` will integrate them.
18240d553cfSPaul Beesley
18334760951SPaul Beesley   -  Typically, the :ref:`maintainers` will merge the changes into the
18440d553cfSPaul Beesley      ``integration`` branch.
185*7969747eSSandrine Bailleux
18640d553cfSPaul Beesley   -  If the changes are not based on a sufficiently-recent commit, or if they
18734760951SPaul Beesley      cannot be automatically rebased, then the :ref:`maintainers` may rebase it
1883d28b0a4SSandrine Bailleux      on the ``integration`` branch or ask you to do so.
189*7969747eSSandrine Bailleux
19040d553cfSPaul Beesley   -  After final integration testing, the changes will make their way into the
1913d28b0a4SSandrine Bailleux      ``master`` branch. If a problem is found during integration, the
1923d28b0a4SSandrine Bailleux      :ref:`maintainers` will request your help to solve the issue. They may
1933d28b0a4SSandrine Bailleux      revert your patches and ask you to resubmit a reworked version of them or
1943d28b0a4SSandrine Bailleux      they may ask you to provide a fix-up patch.
19540d553cfSPaul Beesley
19640d553cfSPaul BeesleyBinary Components
19740d553cfSPaul Beesley-----------------
19840d553cfSPaul Beesley
19940d553cfSPaul Beesley-  Platforms may depend on binary components submitted to the `Trusted Firmware
20040d553cfSPaul Beesley   binary repository`_ if they require code that the contributor is unable or
20140d553cfSPaul Beesley   unwilling to open-source. This should be used as a rare exception.
20240d553cfSPaul Beesley-  All binary components must follow the contribution guidelines (in particular
20340d553cfSPaul Beesley   licensing rules) outlined in the `readme.rst <tf-binaries-readme_>`_ file of
20440d553cfSPaul Beesley   the binary repository.
20540d553cfSPaul Beesley-  Binary components must be restricted to only the specific functionality that
20640d553cfSPaul Beesley   cannot be open-sourced and must be linked into a larger open-source platform
20740d553cfSPaul Beesley   port. The majority of the platform port must still be implemented in open
20840d553cfSPaul Beesley   source. Platform ports that are merely a thin wrapper around a binary
20940d553cfSPaul Beesley   component that contains all the actual code will not be accepted.
21040d553cfSPaul Beesley-  Only platform port code (i.e. in the ``plat/<vendor>`` directory) may rely on
21140d553cfSPaul Beesley   binary components. Generic code must always be fully open-source.
21240d553cfSPaul Beesley
21340d553cfSPaul Beesley--------------
21440d553cfSPaul Beesley
215e63f5d12SPaul Beesley*Copyright (c) 2013-2020, Arm Limited and Contributors. All rights reserved.*
21640d553cfSPaul Beesley
21740d553cfSPaul Beesley.. _developer.trustedfirmware.org: https://developer.trustedfirmware.org
2183d28b0a4SSandrine Bailleux.. _review.trustedfirmware.org: https://review.trustedfirmware.org
21940d553cfSPaul Beesley.. _issue: https://developer.trustedfirmware.org/project/board/1/
220f6ad51c8SJohn Tsichritzis.. _Trusted Firmware-A: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
22140d553cfSPaul Beesley.. _Git guidelines: http://git-scm.com/book/ch5-2.html
22240d553cfSPaul Beesley.. _Gerrit Uploading Changes documentation: https://review.trustedfirmware.org/Documentation/user-upload.html
22340d553cfSPaul Beesley.. _Gerrit Signed-off-by Lines guidelines: https://review.trustedfirmware.org/Documentation/user-signedoffby.html
22440d553cfSPaul Beesley.. _Gerrit Change-Ids documentation: https://review.trustedfirmware.org/Documentation/user-changeid.html
2253d28b0a4SSandrine Bailleux.. _TF-A Tests: https://trustedfirmware-a-tests.readthedocs.io
22640d553cfSPaul Beesley.. _Trusted Firmware binary repository: https://review.trustedfirmware.org/admin/repos/tf-binaries
22740d553cfSPaul Beesley.. _tf-binaries-readme: https://git.trustedfirmware.org/tf-binaries.git/tree/readme.rst
2283d28b0a4SSandrine Bailleux.. _TF-A mailing list: https://lists.trustedfirmware.org/mailman/listinfo/tf-a
229