Development: How to submit patches: Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
(some minor edits, rephrasing.)
Line 4: Line 4:
For V4L-DVB driver modules and/or documentation, patches should be created against the [http://linuxtv.org/hg/v4l-dvb master V4L-DVB mercurial tree]; for instructions on obtaining and building these sources, see the "[[How to Obtain, Build and Install V4L-DVB Device Drivers]]" article. Similarly, for submissions related to the dvb-apps, one should patch against the [http://linuxtv.org/hg/dvb-apps dvb-apps mercurial tree].
For V4L-DVB driver modules and/or documentation, patches should be created against the [http://linuxtv.org/hg/v4l-dvb master V4L-DVB mercurial tree]; for instructions on obtaining and building these sources, see the "[[How to Obtain, Build and Install V4L-DVB Device Drivers]]" article. Similarly, for submissions related to the dvb-apps, one should patch against the [http://linuxtv.org/hg/dvb-apps dvb-apps mercurial tree].


Post your patches to the [mailto:majordomo@vger.kernel.org?body=subscribe%20linux-media linux-media mailing list] for review and testing. [http://vger.kernel.org/vger-lists.html#linux-media Subscription to the mailing list] is recommended, though it is not required.
Post your patches to the [mailto:majordomo@vger.kernel.org?body=subscribe%20linux-media Linux-Media Mailing List] for review and testing. [http://vger.kernel.org/vger-lists.html#linux-media Subscription to the mailing list] is recommended, though it is not required.


Follow the guidelines in [[Development: Submitting Patches|Submitting Patches]] (cf. [http://linux.yyz.us/patch-format.html jgarzik's version]), including:
Follow the guidelines in [[Development: Submitting Patches|Submitting Patches]] (cf. [http://linux.yyz.us/patch-format.html jgarzik's version]), including:
Line 21: Line 21:
== Firmware submission ==
== Firmware submission ==


Some drivers may require [[Firmware|firmwares]] in order to properly work. In such cases, if the firmware is not already available, some sort of procedure is needed for other users to use the driver.
Some devices may require [[Firmware|firmware(s)]] in order for the device drivers to work properly. In such cases, if the firmware is not already available, some sort of procedure is needed so that end users may make use of the driver.


To follow the Open Source spirit, and to help debugging some troubles, the better is if the firmware is submitted as a source code, under GPL, but unfortunately very few firmwares are submitted with sources. Yet, as submitting firmwares with a source code is not a mandatory requirement, they can be provided on a binary format. However, for it to be available at the Linux distributions, it is required that each firmware should be provided with the distribution and redistribution rights, given by the device or by the chipset manufacturer.
In the spirit of Open Source Software (OSS) development and distribution, it is most preferable if the firmware can be provided by submitting it as open source code, licenced under the GPL. Making the firmware open source facilitates tremendous advantages when it comes to debugging problems (i.e. the concept of many eyes to spot the trouble spots). Unfortunately, very few firmwares are submitted with sources, and, to be sure, this is certainly not a mandatory requirement. Indeed, as it currently stands, most firmware are instead provided in a binary format. However, there is an associated problem with distributing firmware as a closed source "binary blob" -- namely, for it to be made available within Linux distributions, it is required that each firmware should be provided with the distribution and redistribution rights, given specifically by the device or chipset manufacturer.


In order to submit a firmware, an email from the vendor or from the chipset manufacturer to [[mailto://linux-media@vger.kernel.org Linux Media Mailing List - LMML]] and/or to [[mailto:mchehab@infradead.org Mauro (the V4L/DVB Maintainer)]] should be sent containing the license terms and the firmware files. If the licensing is ok, the firmware files will be added at the [[http://git.kernel.org/?p=linux/kernel/git/mchehab/linux-firmware.git V4L/DVB linux-firmware git tree]] and submitted to the upstream linux-firmware tree.
Therefore, if you are a device vendor or original chipset manufacturer and wish to submit the requisite firmware for inclusion within Linux distributions, in order to do so, please email the [mailto://linux-media@vger.kernel.org Linux Media Mailing List (LMML)]], and/or to [mailto:mchehab@infradead.org Mauro (the V4L/DVB Maintainer)], sending copies of the firmware files and the appropriate license terms.


There is no unique model for firmware licensing, but there are some examples at [[http://git.kernel.org/?p=linux/kernel/git/mchehab/linux-firmware.git;a=blob_plain;f=WHENCE;hb=HEAD WHENCE]] file and at the several LICENCE files at the tree. The most common models for non GPL'd firmwares are:
If the licensing terms are deemed acceptable for legally permitting wide redistribution of the firmware software, then the firmware files will be added at the [http://git.kernel.org/?p=linux/kernel/git/mchehab/linux-firmware.git V4L/DVB Linux-firmware git tree] and submitted to the upstream Linux-firmware tree.


Note that there is no unique model for firmware licensing, but there are some examples provided within the [http://git.kernel.org/?p=linux/kernel/git/mchehab/linux-firmware.git;a=blob_plain;f=WHENCE;hb=HEAD WHENCE] file and within the several LICENCE files avaiable at the tree. The most common models for non GPL'd firmwares are:
:* [[firmware model1]]
:* [[firmware model1]]
:* [[firmware model2]]
:* [[firmware model2]]
There are also some existing examples of firmwares released as Open Source Software:

There are also some examples of Open source firmwares:

:* [[GPL model]]
:* [[GPL model]]
:* [[Cinergy T2 license]]
:* [[Cinergy T2 license]]

Revision as of 06:00, 7 September 2009

This article provides an overview for submitting patches against the V4L-DVB source code (for either new or existing kernel driver modules and/or documentation), and as well as for the dvb-apps source. For general references in regards as to how to develop support for a particular device or in writing a new device driver, see here.

Patch Preparation

For V4L-DVB driver modules and/or documentation, patches should be created against the master V4L-DVB mercurial tree; for instructions on obtaining and building these sources, see the "How to Obtain, Build and Install V4L-DVB Device Drivers" article. Similarly, for submissions related to the dvb-apps, one should patch against the dvb-apps mercurial tree.

Post your patches to the Linux-Media Mailing List for review and testing. Subscription to the mailing list is recommended, though it is not required.

Follow the guidelines in Submitting Patches (cf. jgarzik's version), including:

  • Verify best-practice kernel coding style
  • Use [PATCH] in the subject line to get attention ... Note: the patchwork tool (discussed below) actually does NOT rely upon this label for detection of patches; rather, patchwork utilizes logic algorithms to detect for the presence of a patch within an email message. That being the case, the "[PATCH]" flag serves only to alert your human counterparts/peers on the mailing list of your submission
  • Explain what the patch does and to what hardware it applies. Note: All comments you add on your patch will be part of the commit message (except for the meta-tags)
  • Document your work where appropriate (i.e. in the form of patches to the Documentation/video4linux or Documentation/dvb files)
  • Add a Signed-off-by: Your name <name@yoursite.com> as a Developer's Certificate of Origin 1.1
  • Send the patch inline, not as an attachment (unless otherwise asked to do so) ... patches presented in the form of inline text in the body of an email are easier to deal with from the perspective of a peer review process (for more information, see the /usr/src/linux/Documentation/email-clients.txt file; a current copy of which can also be found online here).
  • Note: various web mail interfaces seem to be problematic for patch submissionn, in that:
    • they may break the patch (e.g. line wrapping it) or
    • in the case where you have sent the patch as an attachment, the emailer may use the wrong mime encoding type ... (web mailers often wrongly use "application/octet-stream" for diffs, whereas the proper type is "text/x-patch" ... Note: the patchwork tool (discussed below) is robust in that it supports both mime types "text/x-patch" and "text/plain", but if the emailer has sent it with a different type, the attachment will be disregarded/discarded.

Hint: There is also a checklist for patch submission

Firmware submission

Some devices may require firmware(s) in order for the device drivers to work properly. In such cases, if the firmware is not already available, some sort of procedure is needed so that end users may make use of the driver.

In the spirit of Open Source Software (OSS) development and distribution, it is most preferable if the firmware can be provided by submitting it as open source code, licenced under the GPL. Making the firmware open source facilitates tremendous advantages when it comes to debugging problems (i.e. the concept of many eyes to spot the trouble spots). Unfortunately, very few firmwares are submitted with sources, and, to be sure, this is certainly not a mandatory requirement. Indeed, as it currently stands, most firmware are instead provided in a binary format. However, there is an associated problem with distributing firmware as a closed source "binary blob" -- namely, for it to be made available within Linux distributions, it is required that each firmware should be provided with the distribution and redistribution rights, given specifically by the device or chipset manufacturer.

Therefore, if you are a device vendor or original chipset manufacturer and wish to submit the requisite firmware for inclusion within Linux distributions, in order to do so, please email the Linux Media Mailing List (LMML)], and/or to Mauro (the V4L/DVB Maintainer), sending copies of the firmware files and the appropriate license terms.

If the licensing terms are deemed acceptable for legally permitting wide redistribution of the firmware software, then the firmware files will be added at the V4L/DVB Linux-firmware git tree and submitted to the upstream Linux-firmware tree.

Note that there is no unique model for firmware licensing, but there are some examples provided within the WHENCE file and within the several LICENCE files avaiable at the tree. The most common models for non GPL'd firmwares are:

There are also some existing examples of firmwares released as Open Source Software:

After you've Submitted: What happens Next?

In conjunction with the move to the new Linux-media mailing list, V4L-DVB is now using the Patchwork tool for aggregating patches sent into the list (you can read more about it here). In the past, it was, unfortunately, not uncommon for patches to be overlooked and become lost on the V4L-DVB mailing lists; thus making the adoption of the patchwork tool a very welcome addition. So, provided you have correctly submitted your patch (as discussed above), the steps towards having your code adopted will have automatically been put into motion. You can, of course, check to see the status of your submission from the Patchwork webpage. If patchwork has not picked up your patch (after a reasonable period of time has elapsed), it is quite probable that your submission was incorrect for some reason; please review the information contained in the above section and try again.

After being picked up by patchwork, the first thing you should expect next is that a code review will be performed, and often this is by various parties. This may lead to a series of requests for you to fix any observed problems and require you to then resubmit your work, by repeating the same steps outlined above, until everyone is happy with the submission. In other words: wash, rinse, repeat ;)

Then, when your patch is accepted, it will initially be applied to the main V4L-DVB mercurial tree. Once tested and integrated, such patches are later merged into a git tree by the V4L-DVB maintainer and, upon request, periodically pulled by Linus into one of his own git trees in an intermediate step towards final inclusion into the Linux kernel.