@@ -24,13 +24,30 @@ SECTION 1 - CREATING AND SENDING YOUR CHANGE
24
24
--------------------------------------------
25
25
26
26
27
+ 0) Obtain a current source tree
28
+ -------------------------------
29
+
30
+ If you do not have a repository with the current kernel source handy, use
31
+ git to obtain one. You'll want to start with the mainline repository,
32
+ which can be grabbed with:
33
+
34
+ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
35
+
36
+ Note, however, that you may not want to develop against the mainline tree
37
+ directly. Most subsystem maintainers run their own trees and want to see
38
+ patches prepared against those trees. See the "T:" entry for the subsystem
39
+ in the MAINTAINERS file to find that tree, or simply ask the maintainer if
40
+ the tree is not listed there.
41
+
42
+ It is still possible to download kernel releases via tarballs (as described
43
+ in the next section), but that is the hard way to do kernel development.
27
44
28
45
1) "diff -up"
29
46
------------
30
47
31
- Use "diff -up" or "diff -uprN" to create patches. git generates patches
32
- in this form by default; if you're using git, you can skip this section
33
- entirely.
48
+ If you must generate your patches by hand, use "diff -up" or "diff -uprN"
49
+ to create patches. Git generates patches in this form by default; if
50
+ you're using git, you can skip this section entirely.
34
51
35
52
All changes to the Linux kernel occur in the form of patches, as
36
53
generated by diff(1). When creating your patch, make sure to create it
@@ -156,10 +173,15 @@ Example:
156
173
platform_set_drvdata(), but left the variable "dev" unused,
157
174
delete it.
158
175
176
+ You should also be sure to use at least the first twelve characters of the
177
+ SHA-1 ID. The kernel repository holds a *lot* of objects, making
178
+ collisions with shorter IDs a real possibility. Bear in mind that, even if
179
+ there is no collision with your six-character ID now, that condition may
180
+ change five years from now.
181
+
159
182
If your patch fixes a bug in a specific commit, e.g. you found an issue using
160
183
git-bisect, please use the 'Fixes:' tag with the first 12 characters of the
161
- SHA-1 ID, and the one line summary.
162
- Example:
184
+ SHA-1 ID, and the one line summary. For example:
163
185
164
186
Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")
165
187
@@ -188,6 +210,12 @@ If one patch depends on another patch in order for a change to be
188
210
complete, that is OK. Simply note "this patch depends on patch X"
189
211
in your patch description.
190
212
213
+ When dividing your change into a series of patches, take special care to
214
+ ensure that the kernel builds and runs properly after each patch in the
215
+ series. Developers using "git bisect" to track down a problem can end up
216
+ splitting your patch series at any point; they will not thank you if you
217
+ introduce bugs in the middle.
218
+
191
219
If you cannot condense your patch set into a smaller set of patches,
192
220
then only post say 15 or so at a time and wait for review and integration.
193
221
@@ -445,15 +473,15 @@ which appears in the changelog.
445
473
Special note to back-porters: It seems to be a common and useful practice
446
474
to insert an indication of the origin of a patch at the top of the commit
447
475
message (just after the subject line) to facilitate tracking. For instance,
448
- here's what we see in 2.6 -stable :
476
+ here's what we see in a 3.x -stable release :
449
477
450
- Date: Tue May 13 19:10:30 2008 +0000
478
+ Date: Tue Oct 7 07:26:38 2014 -0400
451
479
452
- SCSI: libiscsi regression in 2.6.25: fix nop timer handling
480
+ libata: Un-break ATA blacklist
453
481
454
- commit 4cf1043593db6a337f10e006c23c69e5fc93e722 upstream
482
+ commit 1c40279960bcd7d52dbdf1d466b20d24b99176c8 upstream.
455
483
456
- And here's what appears in 2.4 :
484
+ And here's what might appear in an older kernel once a patch is backported :
457
485
458
486
Date: Tue May 13 22:12:27 2008 +0200
459
487
@@ -462,7 +490,7 @@ And here's what appears in 2.4 :
462
490
[backport of 2.6 commit b7acbdfbd1f277c1eb23f344f899cfa4cd0bf36a]
463
491
464
492
Whatever the format, this information provides a valuable help to people
465
- tracking your trees, and to people trying to trouble-shoot bugs in your
493
+ tracking your trees, and to people trying to troubleshoot bugs in your
466
494
tree.
467
495
468
496
@@ -558,6 +586,12 @@ method for indicating a bug fixed by the patch. See #2 above for more details.
558
586
559
587
560
588
15) The canonical patch format
589
+ ------------------------------
590
+
591
+ This section describes how the patch itself should be formatted. Note
592
+ that, if you have your patches stored in a git repository, proper patch
593
+ formatting can be had with "git format-patch". The tools cannot create
594
+ the necessary text, though, so read the instructions below anyway.
561
595
562
596
The canonical patch subject line is:
563
597
@@ -672,33 +706,57 @@ See more details on the proper patch format in the following
672
706
references.
673
707
674
708
675
- 16) Sending "git pull" requests (from Linus emails)
709
+ 16) Sending "git pull" requests
710
+ -------------------------------
711
+
712
+ If you have a series of patches, it may be most convenient to have the
713
+ maintainer pull them directly into the subsystem repository with a
714
+ "git pull" operation. Note, however, that pulling patches from a developer
715
+ requires a higher degree of trust than taking patches from a mailing list.
716
+ As a result, many subsystem maintainers are reluctant to take pull
717
+ requests, especially from new, unknown developers.
718
+
719
+ A pull request should have [GIT] or [PULL] in the subject line. The
720
+ request itself should include the repository name and the branch of
721
+ interest on a single line; it should look something like:
722
+
723
+ Please pull from
676
724
677
- Please write the git repo address and branch name alone on the same line
678
- so that I can't even by mistake pull from the wrong branch, and so
679
- that a triple-click just selects the whole thing.
725
+ git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus
680
726
681
- So the proper format is something along the lines of:
727
+ to get these changes:"
682
728
683
- "Please pull from
729
+ A pull request should also include an overall message saying what will be
730
+ included in the request, a "git shortlog" listing of the patches
731
+ themselves, and a diffstat showing the overall effect of the patch series.
732
+ The easiest way to get all this information together is, of course, to let
733
+ git do it for you with the "git request-pull" command.
684
734
685
- git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus
735
+ Some maintainers (including Linus) want to see pull requests from signed
736
+ commits; that increases their confidence that the request actually came
737
+ from you. Linus, in particular, will not pull from public hosting sites
738
+ like GitHub in the absence of a signed tag.
686
739
687
- to get these changes:"
740
+ The first step toward creating such tags is to make a GNUPG key and get it
741
+ signed by one or more core kernel developers. This step can be hard for
742
+ new developers, but there is no way around it. Attending conferences can
743
+ be a good way to find developers who can sign your key.
688
744
689
- so that I don't have to hunt-and-peck for the address and inevitably
690
- get it wrong (actually, I've only gotten it wrong a few times, and
691
- checking against the diffstat tells me when I get it wrong, but I'm
692
- just a lot more comfortable when I don't have to "look for" the right
693
- thing to pull, and double-check that I have the right branch-name).
745
+ Once you have prepared a patch series in git that you wish to have somebody
746
+ pull, create a signed tag with "git tag -s". This will create a new tag
747
+ identifying the last commit in the series and containing a signature
748
+ created with your private key. You will also have the opportunity to add a
749
+ changelog-style message to the tag; this is an ideal place to describe the
750
+ effects of the pull request as a whole.
694
751
752
+ If the tree the maintainer will be pulling from is not the repository you
753
+ are working from, don't forget to push the signed tag explicitly to the
754
+ public tree.
695
755
696
- Please use "git diff -M --stat --summary" to generate the diffstat:
697
- the -M enables rename detection, and the summary enables a summary of
698
- new/deleted or renamed files.
756
+ When generating your pull request, use the signed tag as the target. A
757
+ command like this will do the trick:
699
758
700
- With rename detection, the statistics are rather different [...]
701
- because git will notice that a fair number of the changes are renames.
759
+ git request-pull master git://my.public.tree/linux.git my-signed-tag
702
760
703
761
704
762
----------------------
0 commit comments