Skip to main content.
Navigation:
DENX
>
U-Boot
>
CodingStyle
Translations:
Edit
|
Attach
|
Raw
|
Ref-By
|
Printable
|
More
U-Boot
Sections of this site:
DENX Home
|
DULG
|
ELDK-5
|
Know
|
Training
|
U-Boot
|
U-Bootdoc
Topics
U-Boot Home
Documentation
Source Code
The Custodians
Custodian Repositories
Development Process
Release Cycle
Coding Style
Patches
Tasks
Contacts
Changes
Index
List of pages in U-Boot
Search
---+ U-Boot Coding Style The following Coding Style requirements shall be mandatory for all code contributed to the U-Boot project. Exceptions are only allowed if code from other projects is integrated with no or only minimal changes. The following rules apply: * All contributions to U-Boot should conform to the Linux kernel coding style; see the file [[http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle][ ="Documentation/CodingStyle"= ]] and the script [[http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=scripts/Lindent][ ="scripts/Lindent"= ]] in your Linux kernel source directory. * Make sure to run the [[http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=scripts/checkpatch.pl][checkpatch.pl]] script from the Linux source tree to check your patches. See also [[Patches]] for more comments on this tool. Note that this should be done *before* posting on the mailing list! * Source files originating from different projects (for example the MTD subsystem or the hush shell code from the !BusyBox project) may, after careful consideration, be exempted from these rules. For such files, the original coding style may be kept to ease subsequent migration to newer versions of those sources. * Please note that U-Boot is implemented in C (and to some small parts in Assembler); no C++ is used, so please do not use C++ style comments (//) in your code. * Please also stick to the following formatting rules: * Remove any trailing white space * Use TAB characters for indentation and vertical alignment, not spaces * Make sure NOT to use DOS '\r\n' line feeds * Do not add more than 2 consecutive empty lines to source files * Do not add trailing empty lines to source files * Using the option =git config --global color.diff auto= will help to visually see whitespace problems in =diff= output from =git=. * In Emacs one can use =M-x whitespace-global-mode= to get visual feedback on the nasty details. =M-x whitespace-cleanup= does The Right Thing (tm) Submissions of new code or patches that do not conform to these requirements shall be rejected with a request to reformat the changes. ---+ U-Boot Code Documentation U-Boot adopted the kernel-doc annotation style, this is the only exception from multi-line comment rule of Coding Style. While not mandatory, adding documentation is strongly advised. The Linux kernel [[http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/kernel-doc-nano-HOWTO.txt][kernel-doc document]] appliest with no changes.