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