Development Guidelines: Difference between revisions

From coreboot
Jump to navigation Jump to search
 
(53 intermediate revisions by 11 users not shown)
Line 1: Line 1:
<div style="color: #ff0000">'''This page is work in progress!'''</div>
= Development Environment =


== Required Toolchain ==


= Development Environment =
The easiest way to get a working toolchain is to run <code>make crossgcc</code> in the toplevel directory of a coreboot checkout. Distributions usually modify their compilers in ways incompatible with coreboot. If in doubt, use our toolchain.
== Required toolchains ==
 
* GNU developmentenvironment:
The toolchain consists of:
** GCC (tested: 4.1.2 prerelease http://gcc.gnu.org/)
* GNU development environment:
** binutils (tested: 2.17.50.0.5 http://www.kernel.org/pub/linux/devel/binutils/)
** [http://gcc.gnu.org/ GCC with G++]
* python (tested: 2.4, 2.5)
** [http://www.kernel.org/pub/linux/devel/binutils/ binutils]
* bash (tested: 3.0, 3.1)
* libncurses*-dev
* IASL (package pmtools or  http://www.intel.com/technology/iapc/acpi/downloads.htm)
* [http://www.acpica.org/downloads/ IASL], now part of the '''ACPICA''' download (package ''pmtools'' or ''iasl'' in many distributions)
* package pciutils-devel/pciutils-dev (http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml)


= Coding Guidelines =
= Coding Guidelines =
== General Guidelines ==
== General Guidelines ==


* Encapsulate and isolate assembly language
* Encapsulate and isolate assembly language
* Code shall not be "commented out"
* Code shall not be "commented out"
* No use of floatingpoint arithmetics
* No use of floating-point arithmetics
* No hiding of identifiers defined in outerscopes
* No hiding of identifiers defined in outer scopes
* Typedefs are unique (device_t?)
* Typedefs are unique (device_t?)
* Functions shall have prototype declarations
* Functions shall have prototype declarations
* Local functions should be declared static
* Local functions should be declared static
* No definitionsin headerfiles
* No function definitions in header files
* All variables are assigned before use
* All variables are assigned before use
* All objects should have fully qualified types (unsigned int instead of unsigned)
* All objects should have fully qualified types (''unsigned int'' instead of ''unsigned'')
* We suggest trying to import more such rules, such as additional ones described in [http://www.misra.org.uk/index.htm MISRA-C 2004] (Guidelines for the use of C in critical systems)
* Types which indicate signedness and bitness should be used  (''uint32_t'' or ''u32'' instead of ''unsigned int'')
* We suggest trying to import more such rules, such as additional ones described in [http://www.misra.org.uk/index.htm MISRA-C 2012] (''Guidelines for the use of C in critical systems'')
 
== Variable types ==
 
Whenever possible, please use a variable type which is explicit about the size of data it can hold. For example, use '''uint32_t''' or '''u32''' instead of '''unsigned long''' when referencing a 32-bit wide register.
 
=== short int names vs stdint names ===
 
There is '''currently no hard rule''' on whether one should use short int types ('''u32'''), or stdint types ('''uint32_t'''). Whichever type you elect to use, please use common sense and stay consistent.
 
== Assembly Language ==
 
To keep the code consistent across the different supported platforms, AT&T syntax is to be used through-out the project. We are working actively on replacing the existing Intel syntax code with AT&T syntax. No new Intel syntax code is allowed into the project.
 
It is highly encouraged to not use inline assembly, but instead to encapsulate and isolate the use of assembly language to pure assembly files.


== Comments ==
== Comments ==
Line 34: Line 50:


== Coding Style ==
== Coding Style ==
* We use the [http://lxr.linux.no/source/Documentation/CodingStyle Linux kernel coding style] for LinuxBIOS.
 
* We use the coreboot [[Coding Style]] throughout the project.
* You can use the 'indent' tool to fix the coding style like this:
indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs *.[ch]
:Do not trust 'indent' blindly, though. It sometimes gets things wrong. Manual corrections may be required.
 
== The 80 character limit ==
 
Lines larger than 80 columns should be broken down into readable pieces. This includes not only source files, but also Makefiles, Kconfig files, and any file meant to be edited by a human. We recommend setting your editor to show the 80th character limit.
This limit is not a relic from long forgotten times, but a very practical and efficient way to organize code and increase productivity. Several files can be edited on the same monitor, without the need to side-scroll. Side-scrolling source files is inefficient, time-consuming, and uncomfortable. On average, 95% of source lines are shorter than 80 characters, so limiting the line length is this manner is not only _not_ an impediment, it also gets you to think on how to best organize the code.


= Documentation Guidelines =
= Documentation Guidelines =
== General guidelines and tips ==
 
* Documentation should be put into the WIKI or made available as PDF
== General Guidelines and Tips ==
 
* Documentation should be put into the wiki and/or in the code as Doxygen comments
* Avoid using different styles and looks of documentation
* Avoid using different styles and looks of documentation
* There's a documentation directory in the source tree ;-)
* Document ''why'' and ''what'', not ''how'' (No comments like ''/* add one to i */'')
* Document "what", not "how" (No comments like ''// add one to i'' )
* Document assumptions, stipulations etc...
* Document assumptions, stipulations etc...
* Document design and concepts!
* Document design and concepts!
* Not lots of documentation but good documentation
* Not lots of documentation but good documentation
* Structured documentation
* Structured documentation
* Focus: Whom are you addressing in your Documentation? Write documentation for users, developers, vendors, ...
* Focus: Whom are you addressing in your documentation? Write documentation for users, developers, vendors, ...


== Automatic documentation ==
== Automatic documentation ==
* Doxygen-generated API- and code documentation is available at http://qa.linuxbios.org/docs/. This documentation is updated on every 10th checkin.
 
* To createa doxygen comment, write
* Doxygen-generated API- and code documentation is available at http://qa.coreboot.org/docs/. This documentation is updated on every 10th checkin.
* To create a Doxygen comment, write
  /**
  /**
  * this is a doxygen comment  
  * Sample comment.
  */
  */
:or
:or
  /** doxygen comment */
  /** Sample comment. */
* There are a few commands that describe what kind of comment you are adding:  
* There are a few commands that describe what kind of comment you are adding:
::@brief – short description of a function
::@param &mdash; input parameters of a function
::@param input parameters of a function
::@return &mdash; return value of a function
::@return return value of a function
* A list of all commands is available at http://www.stack.nl/~dimitri/doxygen/commands.html
* List of all commands is available at http://www.stack.nl/~dimitri/doxygen/commands.html
 
Full example:
 
/**
  * Calculate the length of a string.
  *
  * @param str The input string.
  * @return The length of the string, not including the final NUL character.
  */
static inline size_t strlen(const char *str)
{
        /* ... */
}


= Testing =
= Testing =


Every commit will be processed by the autobuild and autotest system available at http://qa.linuxbios.org/. In addition please run autobuild yourself before submitting  
Every commit will be processed by the autobuild and autotest system available at http://qa.coreboot.org/. In addition please run autobuild yourself before submitting patches.
patches.


== autobuild ==
== autobuild ==


Autobuild can be found at [http://tracker.linuxbios.org/trac/LinuxBIOS/browser/trunk/LinuxBIOSv2/util/abuild/abuild LinuxBIOSv2/util/abuild].  
Autobuild can be found at [http://review.coreboot.org/gitweb?p=coreboot.git;a=tree;f=util/abuild;hb=HEAD coreboot/util/abuild].  


Please run ''abuild'' '''before''' you commit.  
Please run ''abuild'' '''before''' you commit.


Autobuild is also running on every check-in to the repository and sending result mails to the LinuxBIOS [[Mailinglist|mailing list]]. The results of this build is also available at http://qa.linuxbios.org/ in the ''build'' section of each revision.
Autobuild is also running on every check-in to the repository. The results of this build are also available at http://qa.coreboot.org/.


== autotest ==
== autotest ==


Each revision is also tested with an automated test system: http://qa.linuxbios.org/overview.php?tested=1. If you developed LinuxBIOS for a certain mainboard or wish to help improving LinuxBIOS' quality by running the testsuite on one of your mainboards, please contact [mailto:info@coresystems.de info@coresystems.de].
We can also run automatic tests on boards, if we find contributors willing to have a board automatically managed by our QA system. This requires a permanent connection to the net, a host system and some special circuitry. If interested, please contact us using the [[Mailinglist|mailing list]].


= How to contribute =
= How to contribute =
Line 83: Line 121:
== Creating Patches ==
== Creating Patches ==


* '''Always use a checkout of the latest svn revision of the code'''. Patches that do not apply on the latest svn revision will be rejected!
* We use gerrit for change management, using the instance on http://review.coreboot.org/
* While not necessary with gerrit, '''make sure that your change is against current master'''. Patches that fail on merge (after some developer looked at it and approved it) might linger around until '''you''' update it.
* Rebase, if necessary, '''then test''' again. You might be the only contributor with that specific mainboard.
* Make sure all new and modified files contain the [[Development Guidelines#Common_License_Header|proper license headers]] (see below).
* Make sure all new and modified files contain the [[Development Guidelines#Common_License_Header|proper license headers]] (see below).
* If your patch is supposed to add new files, please add them to your local repository before creating a diff. Use
* Make sure all added files are actually within the commit.
svn add path/to/file
* Make one commit per logical change.
* Create your patches by executing the following command in the top-level LinuxBIOSv2 directory:
* For more details on using gerrit, see our [[Git]] documentation. Things are somewhat different (eg. it's normal to rebase changes that were already pushed).
svn diff > ~/some_descriptive_name.patch
* Double-check that your changes are correct, and that the commit only contains what you think it contains.
* Open the patch in a text-editor and double-check that your changes are correct, and that the patch only contains what you think it contains.


== Sign-off Procedure ==
== Sign-off Procedure ==


Verbatim copy from the Linux kernel (we might modify this a bit):
We employ a similar sign-off procedure for coreboot
[http://web.archive.org/web/20070306195036/http://osdlab.org/newsroom/press_releases/2004/2004_05_24_dco.html as the Linux kernel developers] do.
Please add a note such as
Signed-off-by: Random J Developer <random@developer.example.org>
to your email/patch if you agree with the following Developer's Certificate of Origin 1.1.


To improve tracking of who did what, especially with patches that can
Patches without a Signed-off-by cannot be pushed to gerrit!
percolate to their final resting place in the kernel through several
layers of maintainers, we've introduced a "sign-off" procedure on
patches that are being emailed around.<br />
The sign-off is a simple line at the end of the explanation for the
patch, which certifies that you wrote it or otherwise have the right to
pass it on as a open-source patch.  The rules are pretty simple: if you
can certify the below:<br />
        Developer's Certificate of Origin 1.1<br />
        By making a contribution to this project, I certify that:<br />
        (a) The contribution was created in whole or in part by me and I
            have the right to submit it under the open source license
            indicated in the file; or<br />
        (b) The contribution is based upon previous work that, to the best
            of my knowledge, is covered under an appropriate open source
            license and I have the right under that license to submit that
            work with modifications, whether created in whole or in part
            by me, under the same open source license (unless I am
            permitted to submit under a different license), as indicated
            in the file; or<br />
        (c) The contribution was provided directly to me by some other
            person who certified (a), (b) or (c) and I have not modified
            it.<br />
        (d) I understand and agree that this project and the contribution
            are public and that a record of the contribution (including all
            personal information I submit with it, including my sign-off) is
            maintained indefinitely and may be redistributed consistent with
            this project or the open source license(s) involved.<br />
then you just add a line saying<br />
        Signed-off-by: Random J Developer <random@developer.example.org><br />
Some people also put extra tags at the end.  They'll just be ignored for
now, but you can do this to mark internal company procedures or just
point out some special detail about the sign-off.


<span style="color:red">You have to use your real name in the Signed-off-by line and in any copyright notices you add.</span> Patches without an associated real name cannot be committed!


== Reviews ==
'''Developer's Certificate of Origin 1.1:'''


No significant check-in may be made without getting your code reviewed. If your code is reviewed, you may add a line saying
By making a contribution to this project, I certify that:<br />
        Acked-by: Random J Developer <random@developer.example.org>
(a) The contribution was created in whole or in part by me and I have
to your commit.
the right to submit it under the open source license indicated in the file; or<br />
(b) The contribution is based upon previous work that, to the best of my
knowledge, is covered under an appropriate open source license and I have the
right under that license to submit that work with modifications, whether created
in whole or in part by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated in the file; or<br />
(c) The contribution was provided directly to me by some other person who
certified (a), (b) or (c) and I have not modified it; and<br />
(d) In the case of each of (a), (b), or (c), I understand and agree that
this project and the contribution are public and that a record of the contribution
(including all personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with this project or the
open source license indicated in the file.


If you are fixing trivial things like a typo in a comment, you may specify your
<small>Note: The [http://web.archive.org/web/20070306195036/http://osdlab.org/newsroom/press_releases/2004/2004_05_24_dco.html Developer's Certificate of Origin 1.1] is licensed under the terms of the [http://creativecommons.org/licenses/by-sa/2.5/ Creative Commons Attribution-ShareAlike 2.5 License].</small>
own email address in the Acked-by: field, and noting the word "trivial" in the commit description (in '''addition''' to the commit description)


== Reviews ==


* Send your patch to the [[Mailinglist|mailing list]] for review.
* Send your patch to [[Git|gerrit]] for review.
** Start the email with a detailed description of what the patch does and why. This text will usually end up in the commit logs so don't clutter it with useless stuff which should not go into the commit message.
** Provide useful commit messages. Explain what the change does and why. Our short intro to [[Git|git]] explains the format in more detail.
** Add a single line containing your "[[Development Guidelines#Sign-off_Procedure|sign-off]]" after the description of the patch.
** Add a single line containing your "[[Development Guidelines#Sign-off_Procedure|sign-off]]" after the description of the patch (<code>git commit -s</code> helps, but make sure you understand and comply with the DCO).
*** Example: ''Signed-off-by: John Doe <john@example.com>''
*** Example: ''Signed-off-by: John Doe <john@example.com>''
** Add a single line which only contains "---". Everything which comes after that line will not be included in the commit message.
* The developers will review and/or test your change and send comments or suggestions. Please push updated patches as described in "[[Git#Evolving_patches|evolving patches]]".
* The developers on the mailing list will review and/or test your patch and send comments or suggestions. Please post updated patches to the mailing list again.
* If the change looks ok to one or more developers, they will approve and submit it to the master branch.
* If the patch looks ok to one or more developers, they will reply to your mail with an Acked-by: line.
** Example: ''Acked-by: John Doe <john@example.com>''
* Every non-trivial patch must get at least one Acked-by: to allow it to be commited.
 
== Svn Commits ==
 
* Double-check that you're really committing what you think you are, e.g. by typing the following in the top-level LinuxBIOSv2 directory:
svn diff | less
* Include the following information in the svn commit message:
** The description from the email containing the patch.
** All Signed-off-by: and Acked-by: lines your patch received.
** Reference or close bugs which are fixed by the commit, or are related to it. See [[Development Guidelines#How_to_close_Trac_issues_automatically_via_email|below]] for details.


= Bug-Tracker =
= Bug-Tracker =


== Where is the LinuxBIOS bug tracker ==
Issues can be documented at https://ticket.coreboot.org/.
 
It is available at http://tracker.linuxbios.org/. Log in with your svn username and password if you have one.
 
== How to close Trac issues automatically via svn commits ==
 
It searches commit messages for text in the form of:
* command #1
* command #1, #2
* command #1 & #2
* command #1 and #2<br />
 
You can have more then one command in a message. The following commands
are supported. There is more then one spelling for each command, to make
this as user-friendly as possible.<br />
* closes, fixes
  The specified issue numbers are closed with the contents of this
  commit message being added to it.
* references, refs, addresses, re
  The specified issue numbers are left in their current status, but
  the contents of this commit message are added to their notes.<br />
A fairly complicated example of what you can do is with a commit message of:<br />
    Changed blah and foo to do this or that. Fixes #10 and #12, and refs #12.<br />
This will close #10 and #12, and add a note to #12.


= License Issues =
= License Issues =


* Contributed code must be GPL'd (preferrably GPLv2 or any later version), or at least have a GPL-compatible license.
* Contributed code must be GPL'd (preferrably 'GPLv2', but 'GPLv2 or any later version' is fine, too). At the very minimum the code must have a GPLv2-compatible license.


== Common License Header ==
== Common License Header ==


Please quote the full GPL license header text in every file, as shown below. It should contain:
Please quote the shortened GPL license header text in every file, as shown below. It should contain:


* The '''year(s)''' when the code was written or modified and a '''copyright note''' of you (or your company, if you are contributing as part of your employment, and thus the copyright belongs to your company). Also, please provide an '''email address''' so that you can be contacted if questions arise.
* The '''year(s)''' when the code was written or modified and a '''copyright note''' of you (or your company, if you are contributing as part of your employment, and thus the copyright belongs to your company). Also, please provide an '''email address''' if possible so that you can be contacted if questions arise.
** Example:
** Example:
::''Copyright (C) 2006 John Doe <john@example.com>''
::''Copyright (C) 2006 John Doe <john@example.com>''
::''Copyright (C) 2004-2006 Company, Inc.''
::''Copyright (C) 2004-2006 Company, Inc.''
* An extra line which lists the '''author of the code, if the copyright holder is not the same as the author''' (e.g. if you work for a company and the company owns the copyright).
** Example:
::''Copyright (C) 2004-2006 Company, Inc.''
::''Written by Janet Doe <janet@example.com> for Company, Inc.''
* The full '''GPL header''' as shown below.
* The full '''GPL header''' as shown below.


Line 207: Line 192:


  /*
  /*
   * This file is part of the LinuxBIOS project.
   * This file is part of the coreboot project.
  *
  * Copyright (C) 2003-2005 John Doe <john@example.com>
  * Copyright (C) 2005 Jane Doe <jane@example.com>
   *
   *
  * Copyright (C) 2003-2005 Jane Doe <jane@example.com>
   * Copyright (C) 2006 Company, Inc.
   * Copyright (C) 2006 Company, Inc.
  * Written by Janet Doe <janet@example.com> for Company, Inc.
   *
   *
   * This program is free software; you can redistribute it and/or modify
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * the Free Software Foundation; version 2 of the License.
  * (at your option) any later version.
   *
   *
   * This program is distributed in the hope that it will be useful,
   * This program is distributed in the hope that it will be useful,
Line 224: Line 205:
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
   */
   */


Line 233: Line 210:


  ##
  ##
  ## This file is part of the LinuxBIOS project.
  ## This file is part of the coreboot project.
##
## Copyright (C) 2003-2005 John Doe <john@example.com>
## Copyright (C) 2005 Jane Doe <jane@example.com>
  ##
  ##
## Copyright (C) 2003-2005 Jane Doe <jane@example.com>
  ## Copyright (C) 2006 Company, Inc.
  ## Copyright (C) 2006 Company, Inc.
## Written by Janet Doe <janet@example.com> for Company, Inc.
  ##
  ##
  ## This program is free software; you can redistribute it and/or modify
  ## This program is free software; you can redistribute it and/or modify
  ## it under the terms of the GNU General Public License as published by
  ## it under the terms of the GNU General Public License as published by
  ## the Free Software Foundation; either version 2 of the License, or
  ## the Free Software Foundation; version 2 of the License.
## (at your option) any later version.
  ##
  ##
  ## This program is distributed in the hope that it will be useful,
  ## This program is distributed in the hope that it will be useful,
Line 250: Line 223:
  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ## GNU General Public License for more details.
  ## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  ##
  ##

Latest revision as of 17:36, 25 January 2016

Development Environment

Required Toolchain

The easiest way to get a working toolchain is to run make crossgcc in the toplevel directory of a coreboot checkout. Distributions usually modify their compilers in ways incompatible with coreboot. If in doubt, use our toolchain.

The toolchain consists of:

  • GNU development environment:
  • libncurses*-dev
  • IASL, now part of the ACPICA download (package pmtools or iasl in many distributions)

Coding Guidelines

General Guidelines

  • Encapsulate and isolate assembly language
  • Code shall not be "commented out"
  • No use of floating-point arithmetics
  • No hiding of identifiers defined in outer scopes
  • Typedefs are unique (device_t?)
  • Functions shall have prototype declarations
  • Local functions should be declared static
  • No function definitions in header files
  • All variables are assigned before use
  • All objects should have fully qualified types (unsigned int instead of unsigned)
  • Types which indicate signedness and bitness should be used (uint32_t or u32 instead of unsigned int)
  • We suggest trying to import more such rules, such as additional ones described in MISRA-C 2012 (Guidelines for the use of C in critical systems)

Variable types

Whenever possible, please use a variable type which is explicit about the size of data it can hold. For example, use uint32_t or u32 instead of unsigned long when referencing a 32-bit wide register.

short int names vs stdint names

There is currently no hard rule on whether one should use short int types (u32), or stdint types (uint32_t). Whichever type you elect to use, please use common sense and stay consistent.

Assembly Language

To keep the code consistent across the different supported platforms, AT&T syntax is to be used through-out the project. We are working actively on replacing the existing Intel syntax code with AT&T syntax. No new Intel syntax code is allowed into the project.

It is highly encouraged to not use inline assembly, but instead to encapsulate and isolate the use of assembly language to pure assembly files.

Comments

References

If you are referencing a data sheet or other documentation in the code, please add the name or document number in addition to the URL. Vendors just love to rearrange their websites (and some remove documentation on their old products altogether)! If we have the name/number (or even just the filename of the PDF) at least there's a chance to google for it again (either on the vendor's site or on some archive).

Coding Style

  • We use the coreboot Coding Style throughout the project.
  • You can use the 'indent' tool to fix the coding style like this:
indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs *.[ch]
Do not trust 'indent' blindly, though. It sometimes gets things wrong. Manual corrections may be required.

The 80 character limit

Lines larger than 80 columns should be broken down into readable pieces. This includes not only source files, but also Makefiles, Kconfig files, and any file meant to be edited by a human. We recommend setting your editor to show the 80th character limit. This limit is not a relic from long forgotten times, but a very practical and efficient way to organize code and increase productivity. Several files can be edited on the same monitor, without the need to side-scroll. Side-scrolling source files is inefficient, time-consuming, and uncomfortable. On average, 95% of source lines are shorter than 80 characters, so limiting the line length is this manner is not only _not_ an impediment, it also gets you to think on how to best organize the code.

Documentation Guidelines

General Guidelines and Tips

  • Documentation should be put into the wiki and/or in the code as Doxygen comments
  • Avoid using different styles and looks of documentation
  • Document why and what, not how (No comments like /* add one to i */)
  • Document assumptions, stipulations etc...
  • Document design and concepts!
  • Not lots of documentation but good documentation
  • Structured documentation
  • Focus: Whom are you addressing in your documentation? Write documentation for users, developers, vendors, ...

Automatic documentation

  • Doxygen-generated API- and code documentation is available at http://qa.coreboot.org/docs/. This documentation is updated on every 10th checkin.
  • To create a Doxygen comment, write
/**
 * Sample comment.
 */
or
/** Sample comment. */
  • There are a few commands that describe what kind of comment you are adding:
@param — input parameters of a function
@return — return value of a function

Full example:

/**
 * Calculate the length of a string.
 *
 * @param str The input string.
 * @return The length of the string, not including the final NUL character.
 */
static inline size_t strlen(const char *str)
{
        /* ... */
}

Testing

Every commit will be processed by the autobuild and autotest system available at http://qa.coreboot.org/. In addition please run autobuild yourself before submitting patches.

autobuild

Autobuild can be found at coreboot/util/abuild.

Please run abuild before you commit.

Autobuild is also running on every check-in to the repository. The results of this build are also available at http://qa.coreboot.org/.

autotest

We can also run automatic tests on boards, if we find contributors willing to have a board automatically managed by our QA system. This requires a permanent connection to the net, a host system and some special circuitry. If interested, please contact us using the mailing list.

How to contribute

Creating Patches

  • We use gerrit for change management, using the instance on http://review.coreboot.org/
  • While not necessary with gerrit, make sure that your change is against current master. Patches that fail on merge (after some developer looked at it and approved it) might linger around until you update it.
  • Rebase, if necessary, then test again. You might be the only contributor with that specific mainboard.
  • Make sure all new and modified files contain the proper license headers (see below).
  • Make sure all added files are actually within the commit.
  • Make one commit per logical change.
  • For more details on using gerrit, see our Git documentation. Things are somewhat different (eg. it's normal to rebase changes that were already pushed).
  • Double-check that your changes are correct, and that the commit only contains what you think it contains.

Sign-off Procedure

We employ a similar sign-off procedure for coreboot as the Linux kernel developers do. Please add a note such as

Signed-off-by: Random J Developer <random@developer.example.org>

to your email/patch if you agree with the following Developer's Certificate of Origin 1.1.

Patches without a Signed-off-by cannot be pushed to gerrit!

You have to use your real name in the Signed-off-by line and in any copyright notices you add. Patches without an associated real name cannot be committed!

Developer's Certificate of Origin 1.1:

By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it; and
(d) In the case of each of (a), (b), or (c), I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license indicated in the file.

Note: The Developer's Certificate of Origin 1.1 is licensed under the terms of the Creative Commons Attribution-ShareAlike 2.5 License.

Reviews

  • Send your patch to gerrit for review.
    • Provide useful commit messages. Explain what the change does and why. Our short intro to git explains the format in more detail.
    • Add a single line containing your "sign-off" after the description of the patch (git commit -s helps, but make sure you understand and comply with the DCO).
      • Example: Signed-off-by: John Doe <john@example.com>
  • The developers will review and/or test your change and send comments or suggestions. Please push updated patches as described in "evolving patches".
  • If the change looks ok to one or more developers, they will approve and submit it to the master branch.

Bug-Tracker

Issues can be documented at https://ticket.coreboot.org/.

License Issues

  • Contributed code must be GPL'd (preferrably 'GPLv2', but 'GPLv2 or any later version' is fine, too). At the very minimum the code must have a GPLv2-compatible license.

Common License Header

Please quote the shortened GPL license header text in every file, as shown below. It should contain:

  • The year(s) when the code was written or modified and a copyright note of you (or your company, if you are contributing as part of your employment, and thus the copyright belongs to your company). Also, please provide an email address if possible so that you can be contacted if questions arise.
    • Example:
Copyright (C) 2006 John Doe <john@example.com>
Copyright (C) 2004-2006 Company, Inc.
  • The full GPL header as shown below.

Complete example for *.c and *.h files:

/*
 * This file is part of the coreboot project.
 *
 * Copyright (C) 2003-2005 Jane Doe <jane@example.com>
 * Copyright (C) 2006 Company, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

Complete example for Makefiles, config files, Python files, shell scripts etc.:

##
## This file is part of the coreboot project.
##
## Copyright (C) 2003-2005 Jane Doe <jane@example.com>
## Copyright (C) 2006 Company, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##