Back to home page

OSCL-LXR

 
 

    


0001 .. _development_process_intro:
0002 
0003 Introduction
0004 ============
0005 
0006 Executive summary
0007 -----------------
0008 
0009 The rest of this section covers the scope of the kernel development process
0010 and the kinds of frustrations that developers and their employers can
0011 encounter there.  There are a great many reasons why kernel code should be
0012 merged into the official ("mainline") kernel, including automatic
0013 availability to users, community support in many forms, and the ability to
0014 influence the direction of kernel development.  Code contributed to the
0015 Linux kernel must be made available under a GPL-compatible license.
0016 
0017 :ref:`development_process` introduces the development process, the kernel
0018 release cycle, and the mechanics of the merge window.  The various phases in
0019 the patch development, review, and merging cycle are covered.  There is some
0020 discussion of tools and mailing lists.  Developers wanting to get started
0021 with kernel development are encouraged to track down and fix bugs as an
0022 initial exercise.
0023 
0024 :ref:`development_early_stage` covers early-stage project planning, with an
0025 emphasis on involving the development community as soon as possible.
0026 
0027 :ref:`development_coding` is about the coding process; several pitfalls which
0028 have been encountered by other developers are discussed.  Some requirements for
0029 patches are covered, and there is an introduction to some of the tools
0030 which can help to ensure that kernel patches are correct.
0031 
0032 :ref:`development_posting` talks about the process of posting patches for
0033 review. To be taken seriously by the development community, patches must be
0034 properly formatted and described, and they must be sent to the right place.
0035 Following the advice in this section should help to ensure the best
0036 possible reception for your work.
0037 
0038 :ref:`development_followthrough` covers what happens after posting patches; the
0039 job is far from done at that point.  Working with reviewers is a crucial part
0040 of the development process; this section offers a number of tips on how to
0041 avoid problems at this important stage.  Developers are cautioned against
0042 assuming that the job is done when a patch is merged into the mainline.
0043 
0044 :ref:`development_advancedtopics` introduces a couple of "advanced" topics:
0045 managing patches with git and reviewing patches posted by others.
0046 
0047 :ref:`development_conclusion` concludes the document with pointers to sources
0048 for more information on kernel development.
0049 
0050 What this document is about
0051 ---------------------------
0052 
0053 The Linux kernel, at over 8 million lines of code and well over 1000
0054 contributors to each release, is one of the largest and most active free
0055 software projects in existence.  Since its humble beginning in 1991, this
0056 kernel has evolved into a best-of-breed operating system component which
0057 runs on pocket-sized digital music players, desktop PCs, the largest
0058 supercomputers in existence, and all types of systems in between.  It is a
0059 robust, efficient, and scalable solution for almost any situation.
0060 
0061 With the growth of Linux has come an increase in the number of developers
0062 (and companies) wishing to participate in its development.  Hardware
0063 vendors want to ensure that Linux supports their products well, making
0064 those products attractive to Linux users.  Embedded systems vendors, who
0065 use Linux as a component in an integrated product, want Linux to be as
0066 capable and well-suited to the task at hand as possible.  Distributors and
0067 other software vendors who base their products on Linux have a clear
0068 interest in the capabilities, performance, and reliability of the Linux
0069 kernel.  And end users, too, will often wish to change Linux to make it
0070 better suit their needs.
0071 
0072 One of the most compelling features of Linux is that it is accessible to
0073 these developers; anybody with the requisite skills can improve Linux and
0074 influence the direction of its development.  Proprietary products cannot
0075 offer this kind of openness, which is a characteristic of the free software
0076 process.  But, if anything, the kernel is even more open than most other
0077 free software projects.  A typical three-month kernel development cycle can
0078 involve over 1000 developers working for more than 100 different companies
0079 (or for no company at all).
0080 
0081 Working with the kernel development community is not especially hard.  But,
0082 that notwithstanding, many potential contributors have experienced
0083 difficulties when trying to do kernel work.  The kernel community has
0084 evolved its own distinct ways of operating which allow it to function
0085 smoothly (and produce a high-quality product) in an environment where
0086 thousands of lines of code are being changed every day.  So it is not
0087 surprising that Linux kernel development process differs greatly from
0088 proprietary development methods.
0089 
0090 The kernel's development process may come across as strange and
0091 intimidating to new developers, but there are good reasons and solid
0092 experience behind it.  A developer who does not understand the kernel
0093 community's ways (or, worse, who tries to flout or circumvent them) will
0094 have a frustrating experience in store.  The development community, while
0095 being helpful to those who are trying to learn, has little time for those
0096 who will not listen or who do not care about the development process.
0097 
0098 It is hoped that those who read this document will be able to avoid that
0099 frustrating experience.  There is a lot of material here, but the effort
0100 involved in reading it will be repaid in short order.  The development
0101 community is always in need of developers who will help to make the kernel
0102 better; the following text should help you - or those who work for you -
0103 join our community.
0104 
0105 Credits
0106 -------
0107 
0108 This document was written by Jonathan Corbet, corbet@lwn.net.  It has been
0109 improved by comments from Johannes Berg, James Berry, Alex Chiang, Roland
0110 Dreier, Randy Dunlap, Jake Edge, Jiri Kosina, Matt Mackall, Arthur Marsh,
0111 Amanda McPherson, Andrew Morton, Andrew Price, Tsugikazu Shibata, and
0112 Jochen Voß.
0113 
0114 This work was supported by the Linux Foundation; thanks especially to
0115 Amanda McPherson, who saw the value of this effort and made it all happen.
0116 
0117 The importance of getting code into the mainline
0118 ------------------------------------------------
0119 
0120 Some companies and developers occasionally wonder why they should bother
0121 learning how to work with the kernel community and get their code into the
0122 mainline kernel (the "mainline" being the kernel maintained by Linus
0123 Torvalds and used as a base by Linux distributors).  In the short term,
0124 contributing code can look like an avoidable expense; it seems easier to
0125 just keep the code separate and support users directly.  The truth of the
0126 matter is that keeping code separate ("out of tree") is a false economy.
0127 
0128 As a way of illustrating the costs of out-of-tree code, here are a few
0129 relevant aspects of the kernel development process; most of these will be
0130 discussed in greater detail later in this document.  Consider:
0131 
0132 - Code which has been merged into the mainline kernel is available to all
0133   Linux users.  It will automatically be present on all distributions which
0134   enable it.  There is no need for driver disks, downloads, or the hassles
0135   of supporting multiple versions of multiple distributions; it all just
0136   works, for the developer and for the user.  Incorporation into the
0137   mainline solves a large number of distribution and support problems.
0138 
0139 - While kernel developers strive to maintain a stable interface to user
0140   space, the internal kernel API is in constant flux.  The lack of a stable
0141   internal interface is a deliberate design decision; it allows fundamental
0142   improvements to be made at any time and results in higher-quality code.
0143   But one result of that policy is that any out-of-tree code requires
0144   constant upkeep if it is to work with new kernels.  Maintaining
0145   out-of-tree code requires significant amounts of work just to keep that
0146   code working.
0147 
0148   Code which is in the mainline, instead, does not require this work as the
0149   result of a simple rule requiring any developer who makes an API change
0150   to also fix any code that breaks as the result of that change.  So code
0151   which has been merged into the mainline has significantly lower
0152   maintenance costs.
0153 
0154 - Beyond that, code which is in the kernel will often be improved by other
0155   developers.  Surprising results can come from empowering your user
0156   community and customers to improve your product.
0157 
0158 - Kernel code is subjected to review, both before and after merging into
0159   the mainline.  No matter how strong the original developer's skills are,
0160   this review process invariably finds ways in which the code can be
0161   improved.  Often review finds severe bugs and security problems.  This is
0162   especially true for code which has been developed in a closed
0163   environment; such code benefits strongly from review by outside
0164   developers.  Out-of-tree code is lower-quality code.
0165 
0166 - Participation in the development process is your way to influence the
0167   direction of kernel development.  Users who complain from the sidelines
0168   are heard, but active developers have a stronger voice - and the ability
0169   to implement changes which make the kernel work better for their needs.
0170 
0171 - When code is maintained separately, the possibility that a third party
0172   will contribute a different implementation of a similar feature always
0173   exists.  Should that happen, getting your code merged will become much
0174   harder - to the point of impossibility.  Then you will be faced with the
0175   unpleasant alternatives of either (1) maintaining a nonstandard feature
0176   out of tree indefinitely, or (2) abandoning your code and migrating your
0177   users over to the in-tree version.
0178 
0179 - Contribution of code is the fundamental action which makes the whole
0180   process work.  By contributing your code you can add new functionality to
0181   the kernel and provide capabilities and examples which are of use to
0182   other kernel developers.  If you have developed code for Linux (or are
0183   thinking about doing so), you clearly have an interest in the continued
0184   success of this platform; contributing code is one of the best ways to
0185   help ensure that success.
0186 
0187 All of the reasoning above applies to any out-of-tree kernel code,
0188 including code which is distributed in proprietary, binary-only form.
0189 There are, however, additional factors which should be taken into account
0190 before considering any sort of binary-only kernel code distribution.  These
0191 include:
0192 
0193 - The legal issues around the distribution of proprietary kernel modules
0194   are cloudy at best; quite a few kernel copyright holders believe that
0195   most binary-only modules are derived products of the kernel and that, as
0196   a result, their distribution is a violation of the GNU General Public
0197   license (about which more will be said below).  Your author is not a
0198   lawyer, and nothing in this document can possibly be considered to be
0199   legal advice.  The true legal status of closed-source modules can only be
0200   determined by the courts.  But the uncertainty which haunts those modules
0201   is there regardless.
0202 
0203 - Binary modules greatly increase the difficulty of debugging kernel
0204   problems, to the point that most kernel developers will not even try.  So
0205   the distribution of binary-only modules will make it harder for your
0206   users to get support from the community.
0207 
0208 - Support is also harder for distributors of binary-only modules, who must
0209   provide a version of the module for every distribution and every kernel
0210   version they wish to support.  Dozens of builds of a single module can
0211   be required to provide reasonably comprehensive coverage, and your users
0212   will have to upgrade your module separately every time they upgrade their
0213   kernel.
0214 
0215 - Everything that was said above about code review applies doubly to
0216   closed-source code.  Since this code is not available at all, it cannot
0217   have been reviewed by the community and will, beyond doubt, have serious
0218   problems.
0219 
0220 Makers of embedded systems, in particular, may be tempted to disregard much
0221 of what has been said in this section in the belief that they are shipping
0222 a self-contained product which uses a frozen kernel version and requires no
0223 more development after its release.  This argument misses the value of
0224 widespread code review and the value of allowing your users to add
0225 capabilities to your product.  But these products, too, have a limited
0226 commercial life, after which a new version must be released.  At that
0227 point, vendors whose code is in the mainline and well maintained will be
0228 much better positioned to get the new product ready for market quickly.
0229 
0230 Licensing
0231 ---------
0232 
0233 Code is contributed to the Linux kernel under a number of licenses, but all
0234 code must be compatible with version 2 of the GNU General Public License
0235 (GPLv2), which is the license covering the kernel distribution as a whole.
0236 In practice, that means that all code contributions are covered either by
0237 GPLv2 (with, optionally, language allowing distribution under later
0238 versions of the GPL) or the three-clause BSD license.  Any contributions
0239 which are not covered by a compatible license will not be accepted into the
0240 kernel.
0241 
0242 Copyright assignments are not required (or requested) for code contributed
0243 to the kernel.  All code merged into the mainline kernel retains its
0244 original ownership; as a result, the kernel now has thousands of owners.
0245 
0246 One implication of this ownership structure is that any attempt to change
0247 the licensing of the kernel is doomed to almost certain failure.  There are
0248 few practical scenarios where the agreement of all copyright holders could
0249 be obtained (or their code removed from the kernel).  So, in particular,
0250 there is no prospect of a migration to version 3 of the GPL in the
0251 foreseeable future.
0252 
0253 It is imperative that all code contributed to the kernel be legitimately
0254 free software.  For that reason, code from anonymous (or pseudonymous)
0255 contributors will not be accepted.  All contributors are required to "sign
0256 off" on their code, stating that the code can be distributed with the
0257 kernel under the GPL.  Code which has not been licensed as free software by
0258 its owner, or which risks creating copyright-related problems for the
0259 kernel (such as code which derives from reverse-engineering efforts lacking
0260 proper safeguards) cannot be contributed.
0261 
0262 Questions about copyright-related issues are common on Linux development
0263 mailing lists.  Such questions will normally receive no shortage of
0264 answers, but one should bear in mind that the people answering those
0265 questions are not lawyers and cannot provide legal advice.  If you have
0266 legal questions relating to Linux source code, there is no substitute for
0267 talking with a lawyer who understands this field.  Relying on answers
0268 obtained on technical mailing lists is a risky affair.