blob: ad59bc2fc85f3fb2999508e486e2451268fb635e [file] [log] [blame] [view]
Todd Kjosf8978f42019-10-24 17:07:24 -07001# How do I submit patches to Android Common Kernels
2
31. BEST: Make all of your changes to upstream Linux. If appropriate, backport to the stable releases.
4 These patches will be merged automatically in the corresponding common kernels. If the patch is already
5 in upstream Linux, post a backport of the patch that conforms to the patch requirements below.
Todd Kjos2f886a62019-12-12 11:36:29 -08006 - Do not send patches upstream that contain only symbol exports. To be considered for upstream Linux,
7additions of `EXPORT_SYMBOL_GPL()` require an in-tree modular driver that uses the symbol -- so include
8the new driver or changes to an existing driver in the same patchset as the export.
9 - When sending patches upstream, the commit message must contain a clear case for why the patch
10is needed and beneficial to the community. Enabling out-of-tree drivers or functionality is not
Eric Biggersc0a79472023-07-08 00:10:20 +000011a persuasive case.
Todd Kjosf8978f42019-10-24 17:07:24 -070012
132. LESS GOOD: Develop your patches out-of-tree (from an upstream Linux point-of-view). Unless these are
14 fixing an Android-specific bug, these are very unlikely to be accepted unless they have been
15 coordinated with kernel-team@android.com. If you want to proceed, post a patch that conforms to the
16 patch requirements below.
17
18# Common Kernel patch requirements
19
Carlos Llamas3b3f4742021-04-07 23:11:23 +000020- All patches must conform to the Linux kernel coding standards and pass `scripts/checkpatch.pl`
Todd Kjosf8978f42019-10-24 17:07:24 -070021- Patches shall not break gki_defconfig or allmodconfig builds for arm, arm64, x86, x86_64 architectures
22(see https://source.android.com/setup/build/building-kernels)
23- If the patch is not merged from an upstream branch, the subject must be tagged with the type of patch:
24`UPSTREAM:`, `BACKPORT:`, `FROMGIT:`, `FROMLIST:`, or `ANDROID:`.
25- All patches must have a `Change-Id:` tag (see https://gerrit-review.googlesource.com/Documentation/user-changeid.html)
26- If an Android bug has been assigned, there must be a `Bug:` tag.
27- All patches must have a `Signed-off-by:` tag by the author and the submitter
28
29Additional requirements are listed below based on patch type
30
31## Requirements for backports from mainline Linux: `UPSTREAM:`, `BACKPORT:`
32
33- If the patch is a cherry-pick from Linux mainline with no changes at all
34 - tag the patch subject with `UPSTREAM:`.
Matthias Maennich21ec9a72019-12-03 08:03:21 +000035 - add upstream commit information with a `(cherry picked from commit ...)` line
Yongqin Liu8ad9aa942024-07-25 12:43:19 +080036 - if applicable, prefer to cherry-pick the commit from the corresponding LTS branch.
Todd Kjosf8978f42019-10-24 17:07:24 -070037 - Example:
38 - if the upstream commit message is
39```
40 important patch from upstream
41
42 This is the detailed description of the important patch
43
44 Signed-off-by: Fred Jones <fred.jones@foo.org>
45```
Todd Kjos21578d52019-12-12 10:57:32 -080046>- then Joe Smith would upload the patch for the common kernel as
Todd Kjosf8978f42019-10-24 17:07:24 -070047```
48 UPSTREAM: important patch from upstream
49
50 This is the detailed description of the important patch
51
52 Signed-off-by: Fred Jones <fred.jones@foo.org>
53
54 Bug: 135791357
55 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Matthias Maennich21ec9a72019-12-03 08:03:21 +000056 (cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
Todd Kjosf8978f42019-10-24 17:07:24 -070057 Signed-off-by: Joe Smith <joe.smith@foo.org>
58```
59
60- If the patch requires any changes from the upstream version, tag the patch with `BACKPORT:`
61instead of `UPSTREAM:`.
62 - use the same tags as `UPSTREAM:`
Matthias Maennich21ec9a72019-12-03 08:03:21 +000063 - add comments about the changes under the `(cherry picked from commit ...)` line
Todd Kjosf8978f42019-10-24 17:07:24 -070064 - Example:
65```
66 BACKPORT: important patch from upstream
67
68 This is the detailed description of the important patch
69
70 Signed-off-by: Fred Jones <fred.jones@foo.org>
71
72 Bug: 135791357
73 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Matthias Maennich21ec9a72019-12-03 08:03:21 +000074 (cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
Matthias Maennichcba941a2020-01-08 15:11:06 +000075 [joe: Resolved minor conflict in drivers/foo/bar.c ]
Todd Kjosf8978f42019-10-24 17:07:24 -070076 Signed-off-by: Joe Smith <joe.smith@foo.org>
77```
78
79## Requirements for other backports: `FROMGIT:`, `FROMLIST:`,
80
81- If the patch has been merged into an upstream maintainer tree, but has not yet
82been merged into Linux mainline
83 - tag the patch subject with `FROMGIT:`
84 - add info on where the patch came from as `(cherry picked from commit <sha1> <repo> <branch>)`. This
85must be a stable maintainer branch (not rebased, so don't use `linux-next` for example).
86 - if changes were required, use `BACKPORT: FROMGIT:`
87 - Example:
88 - if the commit message in the maintainer tree is
89```
90 important patch from upstream
91
92 This is the detailed description of the important patch
93
94 Signed-off-by: Fred Jones <fred.jones@foo.org>
95```
Todd Kjos21578d52019-12-12 10:57:32 -080096>- then Joe Smith would upload the patch for the common kernel as
Todd Kjosf8978f42019-10-24 17:07:24 -070097```
98 FROMGIT: important patch from upstream
99
100 This is the detailed description of the important patch
101
102 Signed-off-by: Fred Jones <fred.jones@foo.org>
103
104 Bug: 135791357
105 (cherry picked from commit 878a2fd9de10b03d11d2f622250285c7e63deace
106 https://git.kernel.org/pub/scm/linux/kernel/git/foo/bar.git test-branch)
107 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
108 Signed-off-by: Joe Smith <joe.smith@foo.org>
109```
110
111
112- If the patch has been submitted to LKML, but not accepted into any maintainer tree
113 - tag the patch subject with `FROMLIST:`
Matthias Maennich511b8512019-10-28 23:46:05 +0000114 - add a `Link:` tag with a link to the submittal on lore.kernel.org
Todd Kjos9794e7e2020-05-01 13:43:26 -0700115 - add a `Bug:` tag with the Android bug (required for patches not accepted into
116a maintainer tree)
Todd Kjosf8978f42019-10-24 17:07:24 -0700117 - if changes were required, use `BACKPORT: FROMLIST:`
118 - Example:
119```
120 FROMLIST: important patch from upstream
121
122 This is the detailed description of the important patch
123
124 Signed-off-by: Fred Jones <fred.jones@foo.org>
125
126 Bug: 135791357
127 Link: https://lore.kernel.org/lkml/20190619171517.GA17557@someone.com/
128 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
129 Signed-off-by: Joe Smith <joe.smith@foo.org>
130```
131
132## Requirements for Android-specific patches: `ANDROID:`
133
134- If the patch is fixing a bug to Android-specific code
135 - tag the patch subject with `ANDROID:`
136 - add a `Fixes:` tag that cites the patch with the bug
137 - Example:
138```
139 ANDROID: fix android-specific bug in foobar.c
140
141 This is the detailed description of the important fix
142
143 Fixes: 1234abcd2468 ("foobar: add cool feature")
144 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
145 Signed-off-by: Joe Smith <joe.smith@foo.org>
146```
147
148- If the patch is a new feature
149 - tag the patch subject with `ANDROID:`
150 - add a `Bug:` tag with the Android bug (required for android-specific features)
151