contribute.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. == Contributing to Buildroot
  4. There are many ways in which you can contribute to Buildroot: analyzing
  5. and fixing bugs, analyzing and fixing package build failures detected by
  6. the autobuilders, testing and reviewing patches sent by other
  7. developers, working on the items in our TODO list and sending your own
  8. improvements to Buildroot or its manual. The following sections give a
  9. little more detail on each of these items.
  10. If you are interested in contributing to Buildroot, the first thing you
  11. should do is to subscribe to the Buildroot mailing list. This list is
  12. the main way of interacting with other Buildroot developers and to send
  13. contributions to. If you aren't subscribed yet, then refer to
  14. xref:community-resources[] for the subscription link.
  15. If you are going to touch the code, it is highly recommended to use a
  16. git repository of Buildroot, rather than starting from an extracted
  17. source code tarball. Git is the easiest way to develop from and directly
  18. send your patches to the mailing list. Refer to xref:getting-buildroot[]
  19. for more information on obtaining a Buildroot git tree.
  20. === Reproducing, analyzing and fixing bugs
  21. A first way of contributing is to have a look at the open bug reports in
  22. the https://bugs.buildroot.org/buglist.cgi?product=buildroot[Buildroot bug
  23. tracker]. As we strive to keep the bug count as small as possible, all
  24. help in reproducing, analyzing and fixing reported bugs is more than
  25. welcome. Don't hesitate to add a comment to bug reports reporting your
  26. findings, even if you don't yet see the full picture.
  27. === Analyzing and fixing autobuild failures
  28. The Buildroot autobuilders are a set of build machines that continuously
  29. run Buildroot builds based on random configurations. This is done for
  30. all architectures supported by Buildroot, with various toolchains, and
  31. with a random selection of packages. With the large commit activity on
  32. Buildroot, these autobuilders are a great help in detecting problems
  33. very early after commit.
  34. All build results are available at http://autobuild.buildroot.org[],
  35. statistics are at http://autobuild.buildroot.org/stats.php[]. Every day,
  36. an overview of all failed packages is sent to the mailing list.
  37. Detecting problems is great, but obviously these problems have to be
  38. fixed as well. Your contribution is very welcome here! There are
  39. basically two things that can be done:
  40. - Analyzing the problems. The daily summary mails do not contain details
  41. about the actual failures: in order to see what's going on you have to
  42. open the build log and check the last output. Having someone doing
  43. this for all packages in the mail is very useful for other developers,
  44. as they can make a quick initial analysis based on this output alone.
  45. - Fixing a problem. When fixing autobuild failures, you should follow
  46. these steps:
  47. . Check if you can reproduce the problem by building with the same
  48. configuration. You can do this manually, or use the
  49. http://git.buildroot.org/buildroot-test/tree/utils/br-reproduce-build[br-reproduce-build]
  50. script that will automatically clone a Buildroot git repository,
  51. checkout the correct revision, download and set the right
  52. configuration, and start the build.
  53. . Analyze the problem and create a fix.
  54. . Verify that the problem is really fixed by starting from a clean
  55. Buildroot tree and only applying your fix.
  56. . Send the fix to the Buildroot mailing list (see
  57. xref:submitting-patches[]). In case you created a patch against the
  58. package sources, you should also send the patch upstream so that the
  59. problem will be fixed in a later release, and the patch in Buildroot
  60. can be removed.
  61. In the commit message of a patch fixing an autobuild failure, add a
  62. reference to the build result directory, as follows:
  63. ---------------------
  64. Fixes http://autobuild.buildroot.org/results/51000a9d4656afe9e0ea6f07b9f8ed374c2e4069
  65. ---------------------
  66. === Reviewing and testing patches
  67. With the amount of patches sent to the mailing list each day, the
  68. maintainer has a very hard job to judge which patches are ready to apply
  69. and which ones aren't. Contributors can greatly help here by reviewing
  70. and testing these patches.
  71. In the review process, do not hesitate to respond to patch submissions
  72. for remarks, suggestions or anything that will help everyone to
  73. understand the patches and make them better. Please use internet
  74. style replies in plain text emails when responding to patch
  75. submissions.
  76. To indicate approval of a patch, there are three formal tags that keep
  77. track of this approval. To add your tag to a patch, reply to it with the
  78. approval tag below the original author's Signed-off-by line. These tags
  79. will be picked up automatically by patchwork (see
  80. xref:apply-patches-patchwork[]) and will be part of the commit log when
  81. the patch is accepted.
  82. Tested-by:: Indicates that the patch has been tested successfully.
  83. You are encouraged to specify what kind of testing you performed
  84. (compile-test on architecture X and Y, runtime test on target A,
  85. ...). This additional information helps other testers and the
  86. maintainer.
  87. Reviewed-by:: Indicates that you code-reviewed the patch and did your
  88. best in spotting problems, but you are not sufficiently familiar with
  89. the area touched to provide an Acked-by tag. This means that there
  90. may be remaining problems in the patch that would be spotted by
  91. someone with more experience in that area. Should such problems be
  92. detected, your Reviewed-by tag remains appropriate and you cannot
  93. be blamed.
  94. Acked-by:: Indicates that you code-reviewed the patch and you are
  95. familiar enough with the area touched to feel that the patch can be
  96. committed as-is (no additional changes required). In case it later
  97. turns out that something is wrong with the patch, your Acked-by could
  98. be considered inappropriate. The difference between Acked-by and
  99. Reviewed-by is thus mainly that you are prepared to take the blame on
  100. Acked patches, but not on Reviewed ones.
  101. If you reviewed a patch and have comments on it, you should simply reply
  102. to the patch stating these comments, without providing a Reviewed-by or
  103. Acked-by tag. These tags should only be provided if you judge the patch
  104. to be good as it is.
  105. It is important to note that neither Reviewed-by nor Acked-by imply
  106. that testing has been performed. To indicate that you both reviewed and
  107. tested the patch, provide two separate tags (Reviewed/Acked-by and
  108. Tested-by).
  109. Note also that _any developer_ can provide Tested/Reviewed/Acked-by
  110. tags, without exception, and we encourage everyone to do this. Buildroot
  111. does not have a defined group of _core_ developers, it just so happens
  112. that some developers are more active than others. The maintainer will
  113. value tags according to the track record of their submitter. Tags
  114. provided by a regular contributor will naturally be trusted more than
  115. tags provided by a newcomer. As you provide tags more regularly, your
  116. 'trustworthiness' (in the eyes of the maintainer) will go up, but _any_
  117. tag provided is valuable.
  118. Buildroot's Patchwork website can be used to pull in patches for testing
  119. purposes. Please see xref:apply-patches-patchwork[] for more
  120. information on using Buildroot's Patchwork website to apply patches.
  121. [[apply-patches-patchwork]]
  122. ==== Applying Patches from Patchwork
  123. The main use of Buildroot's Patchwork website for a developer is for
  124. pulling in patches into their local git repository for testing
  125. purposes.
  126. When browsing patches in the patchwork management interface, an +mbox+
  127. link is provided at the top of the page. Copy this link address and
  128. run the following commands:
  129. ---------------------
  130. $ git checkout -b <test-branch-name>
  131. $ wget -O - <mbox-url> | git am
  132. ---------------------
  133. Another option for applying patches is to create a bundle. A bundle is
  134. a set of patches that you can group together using the patchwork
  135. interface. Once the bundle is created and the bundle is made public,
  136. you can copy the +mbox+ link for the bundle and apply the bundle
  137. using the above commands.
  138. === Work on items from the TODO list
  139. If you want to contribute to Buildroot but don't know where to start,
  140. and you don't like any of the above topics, you can always work on items
  141. from the http://elinux.org/Buildroot#Todo_list[Buildroot TODO list].
  142. Don't hesitate to discuss an item first on the mailing list or on IRC.
  143. Do edit the wiki to indicate when you start working on an item, so we
  144. avoid duplicate efforts.
  145. [[submitting-patches]]
  146. === Submitting patches
  147. [NOTE]
  148. _Please, do not attach patches to bugs, send them to the mailing list
  149. instead_.
  150. If you made some changes to Buildroot and you would like to contribute
  151. them to the Buildroot project, proceed as follows.
  152. ==== The formatting of a patch
  153. We expect patches to be formatted in a specific way. This is necessary
  154. to make it easy to review patches, to be able to apply them easily to
  155. the git repository, to make it easy to find back in the history how
  156. and why things have changed, and to make it possible to use +git
  157. bisect+ to locate the origin of a problem.
  158. First of all, it is essential that the patch has a good commit
  159. message. The commit message should start with a separate line with a
  160. brief summary of the change, starting with the name of the affected
  161. package. The body of the commit message should describe _why_ this
  162. change is needed, and if necessary also give details about _how_ it
  163. was done. When writing the commit message, think of how the reviewers
  164. will read it, but also think about how you will read it when you look
  165. at this change again a few years down the line.
  166. Second, the patch itself should do only one change, but do it
  167. completely. Two unrelated or weakly related changes should usually be
  168. done in two separate patches. This usually means that a patch affects
  169. only a single package. If several changes are related, it is often
  170. still possible to split them up in small patches and apply them in a
  171. specific order. Small patches make it easier to review, and often
  172. make it easier to understand afterwards why a change was done.
  173. However, each patch must be complete. It is not allowed that the
  174. build is broken when only the first but not the second patch is
  175. applied. This is necessary to be able to use +git bisect+ afterwards.
  176. Of course, while you're doing your development, you're probably going
  177. back and forth between packages, and certainly not committing things
  178. immediately in a way that is clean enough for submission. So most
  179. developers rewrite the history of commits to produce a clean set of
  180. commits that is appropriate for submission. To do this, you need to
  181. use _interactive rebasing_. You can learn about it
  182. https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History[in the Pro
  183. Git book]. Sometimes, it is even easier to discard you history with
  184. +git reset --soft origin/master+ and select individual changes with
  185. +git add -i+ or +git add -p+.
  186. Finally, the patch should be signed off. This is done by adding
  187. +Signed-off-by: Your Real Name <your@email.address>+ at the end of the
  188. commit message. +git commit -s+ does that for you, if configured
  189. properly. The +Signed-off-by+ tag means that you publish the patch
  190. under the Buildroot license (i.e. GPL-2.0+, except for package patches,
  191. which have the upstream license), and that you are allowed to do so.
  192. See http://developercertificate.org/[the Developer Certificate of
  193. Origin] for details.
  194. When adding new packages, you should submit every package in a
  195. separate patch. This patch should have the update to
  196. +package/Config.in+, the package +Config.in+ file, the +.mk+ file, the
  197. +.hash+ file, any init script, and all package patches. If the package
  198. has many sub-options, these are sometimes better added as separate
  199. follow-up patches. The summary line should be something like
  200. +<packagename>: new package+. The body of the commit message can be
  201. empty for simple packages, or it can contain the description of the
  202. package (like the Config.in help text). If anything special has to be
  203. done to build the package, this should also be explained explicitly in
  204. the commit message body.
  205. When you bump a package to a new version, you should also submit a
  206. separate patch for each package. Don't forget to update the +.hash+
  207. file, or add it if it doesn't exist yet. Also don't forget to check if
  208. the +_LICENSE+ and +_LICENSE_FILES+ are still valid. The summary line
  209. should be something like +<packagename>: bump to version <new
  210. version>+. If the new version only contains security updates compared
  211. to the existing one, the summary should be +<packagename>: security
  212. bump to version <new version>+ and the commit message body should show
  213. the CVE numbers that are fixed. If some package patches can be removed
  214. in the new version, it should be explained explicitly why they can be
  215. removed, preferably with the upstream commit ID. Also any other
  216. required changes should be explained explicitly, like configure
  217. options that no longer exist or are no longer needed.
  218. If you are interested in getting notified of build failures and of
  219. further changes in the packages you added or modified, please add
  220. yourself to the DEVELOPERS file. This should be done in a separate
  221. patch of the series. See xref:DEVELOPERS[the DEVELOPERS file] for more
  222. information.
  223. ==== Preparing a patch series
  224. Starting from the changes committed in your local git view, _rebase_
  225. your development branch on top of the upstream tree before generating
  226. a patch set. To do so, run:
  227. ---------------------
  228. $ git fetch --all --tags
  229. $ git rebase origin/master
  230. ---------------------
  231. Now, you are ready to generate then submit your patch set.
  232. To generate it, run:
  233. ---------------------
  234. $ git format-patch -M -n -s -o outgoing origin/master
  235. ---------------------
  236. This will generate patch files in the +outgoing+ subdirectory,
  237. automatically adding the +Signed-off-by+ line.
  238. Once patch files are generated, you can review/edit the commit message
  239. before submitting them, using your favorite text editor.
  240. Buildroot provides a handy tool to know to whom your patches should be
  241. sent, called +get-developers+ (see xref:DEVELOPERS[] for more
  242. information). This tool reads your patches and outputs the appropriate
  243. +git send-email+ command to use:
  244. ---------------------
  245. $ ./utils/get-developers outgoing/*
  246. ---------------------
  247. Use the output of +get-developers+ to send your patches:
  248. ---------------------
  249. $ git send-email --to buildroot@buildroot.org --cc bob --cc alice outgoing/*
  250. ---------------------
  251. Note that +git+ should be configured to use your mail account.
  252. To configure +git+, see +man git-send-email+ or google it.
  253. If you do not use +git send-email+, make sure posted *patches are not
  254. line-wrapped*, otherwise they cannot easily be applied. In such a case,
  255. fix your e-mail client, or better yet, learn to use +git send-email+.
  256. ==== Cover letter
  257. If you want to present the whole patch set in a separate mail, add
  258. +--cover-letter+ to the +git format-patch+ command (see +man
  259. git-format-patch+ for further information). This will generate a
  260. template for an introduction e-mail to your patch series.
  261. A 'cover letter' may be useful to introduce the changes you propose
  262. in the following cases:
  263. * large number of commits in the series;
  264. * deep impact of the changes in the rest of the project;
  265. * RFC footnote:[RFC: (Request for comments) change proposal];
  266. * whenever you feel it will help presenting your work, your choices,
  267. the review process, etc.
  268. ==== Patch revision changelog
  269. When improvements are requested, the new revision of each commit
  270. should include a changelog of the modifications between each
  271. submission. Note that when your patch series is introduced by a cover
  272. letter, an overall changelog may be added to the cover letter in
  273. addition to the changelog in the individual commits.
  274. The best thing to rework a patch series is by interactive rebasing:
  275. +git rebase -i origin/master+. Consult the git manual for more
  276. information.
  277. When added to the individual commits, this changelog is added when
  278. editing the commit message. Below the +Signed-off-by+ section, add
  279. +---+ and your changelog.
  280. Although the changelog will be visible for the reviewers in the mail
  281. thread, as well as in http://patchwork.buildroot.org[patchwork], +git+
  282. will automatically ignores lines below +---+ when the patch will be
  283. merged. This is the intended behavior: the changelog is not meant to
  284. be preserved forever in the +git+ history of the project.
  285. Hereafter the recommended layout:
  286. ---------------
  287. Patch title: short explanation, max 72 chars
  288. A paragraph that explains the problem, and how it manifests itself. If
  289. the problem is complex, it is OK to add more paragraphs. All paragraphs
  290. should be wrapped at 72 characters.
  291. A paragraph that explains the root cause of the problem. Again, more
  292. than on paragraph is OK.
  293. Finally, one or more paragraphs that explain how the problem is solved.
  294. Don't hesitate to explain complex solutions in detail.
  295. Signed-off-by: John DOE <john.doe@example.net>
  296. ---
  297. Changes v2 -> v3:
  298. - foo bar (suggested by Jane)
  299. - bar buz
  300. Changes v1 -> v2:
  301. - alpha bravo (suggested by John)
  302. - charly delta
  303. ---------------
  304. Any patch revision should include the version number. The version number
  305. is simply composed of the letter +v+ followed by an +integer+ greater or
  306. equal to two (i.e. "PATCH v2", "PATCH v3" ...).
  307. This can be easily handled with +git format-patch+ by using the option
  308. +--subject-prefix+:
  309. ---------------------
  310. $ git format-patch --subject-prefix "PATCH v4" \
  311. -M -s -o outgoing origin/master
  312. ---------------------
  313. Since git version 1.8.1, you can also use +-v <n>+ (where <n> is the
  314. version number):
  315. ---------------------
  316. $ git format-patch -v4 -M -s -o outgoing origin/master
  317. ---------------------
  318. When you provide a new version of a patch, please mark the old one as
  319. superseded in http://patchwork.buildroot.org[patchwork]. You need to
  320. create an account on http://patchwork.buildroot.org[patchwork] to be
  321. able to modify the status of your patches. Note that you can only change
  322. the status of patches you submitted yourself, which means the email
  323. address you register in http://patchwork.buildroot.org[patchwork] should
  324. match the one you use for sending patches to the mailing list.
  325. You can also add the +--in-reply-to <message-id>+ option when
  326. submitting a patch to the mailing list. The id of the mail to reply to
  327. can be found under the "Message Id" tag on
  328. http://patchwork.buildroot.org[patchwork]. The advantage of
  329. *in-reply-to* is that patchwork will automatically mark the previous
  330. version of the patch as superseded.
  331. [[reporting-bugs]]
  332. === Reporting issues/bugs or getting help
  333. Before reporting any issue, please check in
  334. xref:community-resources[the mailing list archive] whether someone has
  335. already reported and/or fixed a similar problem.
  336. However you choose to report bugs or get help, either by
  337. opening a bug in the xref:community-resources[bug tracker] or by
  338. xref:community-resources[sending a mail to the mailing list], there are
  339. a number of details to provide in order to help people reproduce and
  340. find a solution to the issue.
  341. Try to think as if you were trying to help someone else; in
  342. that case, what would you need?
  343. Here is a short list of details to provide in such case:
  344. * host machine (OS/release)
  345. * version of Buildroot
  346. * target for which the build fails
  347. * package(s) for which the build fails
  348. * the command that fails and its output
  349. * any information you think that may be relevant
  350. Additionally, you should add the +.config+ file (or if you know how, a
  351. +defconfig+; see xref:customize-store-buildroot-config[]).
  352. If some of these details are too large, do not hesitate to use a
  353. pastebin service. Note that not all available pastebin services will
  354. preserve Unix-style line terminators when downloading raw pastes.
  355. Following pastebin services are known to work correctly:
  356. - https://gist.github.com/
  357. - http://code.bulix.org/