blob: f61e8fbf4aec3999b712c57cfd7141bcc5d1504f [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.
Yongqin Liu6dfa5532024-07-25 13:02:51 +080037 - append new signature tags (e.g. `Bug:`, `Change-Id:`, etc.) at the end to keep the
38 chronological order.
Todd Kjosf8978f42019-10-24 17:07:24 -070039 - Example:
40 - if the upstream commit message is
41```
42 important patch from upstream
43
44 This is the detailed description of the important patch
45
46 Signed-off-by: Fred Jones <fred.jones@foo.org>
47```
Todd Kjos21578d52019-12-12 10:57:32 -080048>- then Joe Smith would upload the patch for the common kernel as
Todd Kjosf8978f42019-10-24 17:07:24 -070049```
50 UPSTREAM: important patch from upstream
51
52 This is the detailed description of the important patch
53
54 Signed-off-by: Fred Jones <fred.jones@foo.org>
55
56 Bug: 135791357
57 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Matthias Maennich21ec9a72019-12-03 08:03:21 +000058 (cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
Todd Kjosf8978f42019-10-24 17:07:24 -070059 Signed-off-by: Joe Smith <joe.smith@foo.org>
60```
61
62- If the patch requires any changes from the upstream version, tag the patch with `BACKPORT:`
63instead of `UPSTREAM:`.
64 - use the same tags as `UPSTREAM:`
Matthias Maennich21ec9a72019-12-03 08:03:21 +000065 - add comments about the changes under the `(cherry picked from commit ...)` line
Todd Kjosf8978f42019-10-24 17:07:24 -070066 - Example:
67```
68 BACKPORT: important patch from upstream
69
70 This is the detailed description of the important patch
71
72 Signed-off-by: Fred Jones <fred.jones@foo.org>
73
74 Bug: 135791357
75 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
Matthias Maennich21ec9a72019-12-03 08:03:21 +000076 (cherry picked from commit c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
Matthias Maennichcba941a2020-01-08 15:11:06 +000077 [joe: Resolved minor conflict in drivers/foo/bar.c ]
Todd Kjosf8978f42019-10-24 17:07:24 -070078 Signed-off-by: Joe Smith <joe.smith@foo.org>
79```
80
81## Requirements for other backports: `FROMGIT:`, `FROMLIST:`,
82
83- If the patch has been merged into an upstream maintainer tree, but has not yet
84been merged into Linux mainline
85 - tag the patch subject with `FROMGIT:`
86 - add info on where the patch came from as `(cherry picked from commit <sha1> <repo> <branch>)`. This
87must be a stable maintainer branch (not rebased, so don't use `linux-next` for example).
88 - if changes were required, use `BACKPORT: FROMGIT:`
89 - Example:
90 - if the commit message in the maintainer tree is
91```
92 important patch from upstream
93
94 This is the detailed description of the important patch
95
96 Signed-off-by: Fred Jones <fred.jones@foo.org>
97```
Todd Kjos21578d52019-12-12 10:57:32 -080098>- then Joe Smith would upload the patch for the common kernel as
Todd Kjosf8978f42019-10-24 17:07:24 -070099```
100 FROMGIT: important patch from upstream
101
102 This is the detailed description of the important patch
103
104 Signed-off-by: Fred Jones <fred.jones@foo.org>
105
106 Bug: 135791357
107 (cherry picked from commit 878a2fd9de10b03d11d2f622250285c7e63deace
108 https://git.kernel.org/pub/scm/linux/kernel/git/foo/bar.git test-branch)
109 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
110 Signed-off-by: Joe Smith <joe.smith@foo.org>
111```
112
113
114- If the patch has been submitted to LKML, but not accepted into any maintainer tree
115 - tag the patch subject with `FROMLIST:`
Matthias Maennich511b8512019-10-28 23:46:05 +0000116 - add a `Link:` tag with a link to the submittal on lore.kernel.org
Todd Kjos9794e7e2020-05-01 13:43:26 -0700117 - add a `Bug:` tag with the Android bug (required for patches not accepted into
118a maintainer tree)
Todd Kjosf8978f42019-10-24 17:07:24 -0700119 - if changes were required, use `BACKPORT: FROMLIST:`
120 - Example:
121```
122 FROMLIST: important patch from upstream
123
124 This is the detailed description of the important patch
125
126 Signed-off-by: Fred Jones <fred.jones@foo.org>
127
128 Bug: 135791357
129 Link: https://lore.kernel.org/lkml/20190619171517.GA17557@someone.com/
130 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
131 Signed-off-by: Joe Smith <joe.smith@foo.org>
132```
133
Greg Kroah-Hartman748f0752025-01-24 07:42:15 +0100134- If a patch has been submitted to the community, but rejected, do NOT use the
135 `FROMLIST:` tag to try to hide this fact. Use the `ANDROID:` tag as
136 described below as this must be considered as an Android-specific submission,
137 not an upstream submission as the community will not accept these changes
138 as-is.
139
Todd Kjosf8978f42019-10-24 17:07:24 -0700140## Requirements for Android-specific patches: `ANDROID:`
141
142- If the patch is fixing a bug to Android-specific code
143 - tag the patch subject with `ANDROID:`
144 - add a `Fixes:` tag that cites the patch with the bug
145 - Example:
146```
147 ANDROID: fix android-specific bug in foobar.c
148
149 This is the detailed description of the important fix
150
151 Fixes: 1234abcd2468 ("foobar: add cool feature")
152 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
153 Signed-off-by: Joe Smith <joe.smith@foo.org>
154```
155
156- If the patch is a new feature
157 - tag the patch subject with `ANDROID:`
158 - add a `Bug:` tag with the Android bug (required for android-specific features)
159