Bios extract: Difference between revisions

From coreboot
Jump to navigation Jump to search
(Sucking in content from http://www.coreboot.org/Development_Guidelines)
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:
'''Manual installation'''
'''Manual installation'''


  $ git clone http://review.coreboot.org/p/bios_extract
  $ git clone http://review.coreboot.org/bios_extract
  $ cd bios_extract
  $ cd bios_extract
  $ make
  $ make
  $ sudo make install
  $ sudo make install


You can view sources via gitweb - http://review.coreboot.org/gitweb?p=bios_extract.git
You can view sources via [https://review.coreboot.org/cgit/bios_extract.git/ cgit].


= Coding Guidelines =
== Development guidelines ==


== General Guidelines ==
We use the same [[Development Guidelines#Coding_style|coding style as coreboot]] (which is basically the Linux kernel coding style).
 
* 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 definitions in header files
* All variables are assigned before use
* 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'')
 
== 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 [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle;hb=HEAD Linux kernel coding style] for bios_extract.
* 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, ...
 
= 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 [[Development Guidelines#Common_License_Header|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 bios_extract
[http://web.archive.org/web/20070306195036/http://osdlab.org/newsroom/press_releases/2004/2004_05_24_dco.html as the Linux 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!
 
<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!
 
'''Developer's Certificate of Origin 1.1:'''
 
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; 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.
 
<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>
 
== Reviews ==
 
* Send your patch to [[Git|gerrit]] for review.
** 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 (<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>''
* 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]]".
* If the change looks ok to one or more developers, they will approve and submit it to the master branch.
 
= License Issues =
 
* Contributed code must be GPL'd (preferrably 'GPLv2 or any later version', but 'GPLv2' is fine, too). At the very minimum the code must have a GPL-compatible license.
Note: some python is under '3-clause BSD license'.
 
== Common License Header ==
 
Please quote the full 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.
** Example:
::''Copyright (C) 2006 John Doe <john@example.com>''
::''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.
 
'''Complete example for *.c and *.h files:'''
 
/*
  * This file is part of the bios_extract project.
  *
  * Copyright (C) 2003-2005 John Doe <john@example.com>
  * Copyright (C) 2005 Jane Doe <jane@example.com>
  * Copyright (C) 2006 Company, Inc.
  * (Written by Janet Doe <janet@example.com> for Company, Inc.)
  * Copyright (C) 2007 Joe Doe <joe@example.com>
  *
  * 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; either version 2 of the License, or
  * (at your option) any later version.
  *
  * 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.
  *
  * 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
  */
 
'''Complete example for Makefiles, config files, Python files, shell scripts etc.:'''
 
##
## This file is part of the bios_extract project.
##
## Copyright (C) 2003-2005 John Doe <john@example.com>
## Copyright (C) 2005 Jane Doe <jane@example.com>
## Copyright (C) 2006 Company, Inc.
## (Written by Janet Doe <janet@example.com> for Company, Inc.)
## Copyright (C) 2007 Joe Doe <joe@example.com>
##
## 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; either version 2 of the License, or
## (at your option) any later version.
##
## 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.
##
## 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 15:02, 22 September 2020

bios_extract is a GPL tool for extracting individual modules from proprietary BIOS/UEFI images.

This utility should work on most modern UNIX-like operating systems; it has been tested on at least Linux and FreeBSD. It is very useful for extracting PCI Expansion ROMs from onboard devices, like IGP graphics, raid controllers, nic boot roms, etc, for inclusion in a coreboot image.

Installation

Manual installation

$ git clone http://review.coreboot.org/bios_extract
$ cd bios_extract
$ make
$ sudo make install

You can view sources via cgit.

Development guidelines

We use the same coding style as coreboot (which is basically the Linux kernel coding style).