blob: 275d318bb9d52e96deac7a9469e83f113cdfa9ef [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.
6
72. LESS GOOD: Develop your patches out-of-tree (from an upstream Linux point-of-view). Unless these are
8 fixing an Android-specific bug, these are very unlikely to be accepted unless they have been
9 coordinated with kernel-team@android.com. If you want to proceed, post a patch that conforms to the
10 patch requirements below.
11
12# Common Kernel patch requirements
13
14- All patches must conform to the Linux kernel coding standards and pass `script/checkpatch.pl`
15- Patches shall not break gki_defconfig or allmodconfig builds for arm, arm64, x86, x86_64 architectures
16(see https://source.android.com/setup/build/building-kernels)
17- If the patch is not merged from an upstream branch, the subject must be tagged with the type of patch:
18`UPSTREAM:`, `BACKPORT:`, `FROMGIT:`, `FROMLIST:`, or `ANDROID:`.
19- All patches must have a `Change-Id:` tag (see https://gerrit-review.googlesource.com/Documentation/user-changeid.html)
20- If an Android bug has been assigned, there must be a `Bug:` tag.
21- All patches must have a `Signed-off-by:` tag by the author and the submitter
22
23Additional requirements are listed below based on patch type
24
25## Requirements for backports from mainline Linux: `UPSTREAM:`, `BACKPORT:`
26
27- If the patch is a cherry-pick from Linux mainline with no changes at all
28 - tag the patch subject with `UPSTREAM:`.
29 - add upstream commit information with a `(cherry-picked from ...)` line
30 - Example:
31 - if the upstream commit message is
32```
33 important patch from upstream
34
35 This is the detailed description of the important patch
36
37 Signed-off-by: Fred Jones <fred.jones@foo.org>
38```
39 - then Joe Smith would upload the patch for the common kernel as
40```
41 UPSTREAM: important patch from upstream
42
43 This is the detailed description of the important patch
44
45 Signed-off-by: Fred Jones <fred.jones@foo.org>
46
47 Bug: 135791357
48 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
49 (cherry-picked from c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
50 Signed-off-by: Joe Smith <joe.smith@foo.org>
51```
52
53- If the patch requires any changes from the upstream version, tag the patch with `BACKPORT:`
54instead of `UPSTREAM:`.
55 - use the same tags as `UPSTREAM:`
56 - add comments about the changes under the `(cherry-picked from ...)` line
57 - Example:
58```
59 BACKPORT: important patch from upstream
60
61 This is the detailed description of the important patch
62
63 Signed-off-by: Fred Jones <fred.jones@foo.org>
64
65 Bug: 135791357
66 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
67 (cherry-picked from c31e73121f4c1ec41143423ac6ce3ce6dafdcec1)
68 [ Resolved minor conflict in drivers/foo/bar.c ]
69 Signed-off-by: Joe Smith <joe.smith@foo.org>
70```
71
72## Requirements for other backports: `FROMGIT:`, `FROMLIST:`,
73
74- If the patch has been merged into an upstream maintainer tree, but has not yet
75been merged into Linux mainline
76 - tag the patch subject with `FROMGIT:`
77 - add info on where the patch came from as `(cherry picked from commit <sha1> <repo> <branch>)`. This
78must be a stable maintainer branch (not rebased, so don't use `linux-next` for example).
79 - if changes were required, use `BACKPORT: FROMGIT:`
80 - Example:
81 - if the commit message in the maintainer tree is
82```
83 important patch from upstream
84
85 This is the detailed description of the important patch
86
87 Signed-off-by: Fred Jones <fred.jones@foo.org>
88```
89 - then Joe Smith would upload the patch for the common kernel as
90```
91 FROMGIT: important patch from upstream
92
93 This is the detailed description of the important patch
94
95 Signed-off-by: Fred Jones <fred.jones@foo.org>
96
97 Bug: 135791357
98 (cherry picked from commit 878a2fd9de10b03d11d2f622250285c7e63deace
99 https://git.kernel.org/pub/scm/linux/kernel/git/foo/bar.git test-branch)
100 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
101 Signed-off-by: Joe Smith <joe.smith@foo.org>
102```
103
104
105- If the patch has been submitted to LKML, but not accepted into any maintainer tree
106 - tag the patch subject with `FROMLIST:`
Matthias Maennich511b8512019-10-28 23:46:05 +0000107 - add a `Link:` tag with a link to the submittal on lore.kernel.org
Todd Kjosf8978f42019-10-24 17:07:24 -0700108 - if changes were required, use `BACKPORT: FROMLIST:`
109 - Example:
110```
111 FROMLIST: important patch from upstream
112
113 This is the detailed description of the important patch
114
115 Signed-off-by: Fred Jones <fred.jones@foo.org>
116
117 Bug: 135791357
118 Link: https://lore.kernel.org/lkml/20190619171517.GA17557@someone.com/
119 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
120 Signed-off-by: Joe Smith <joe.smith@foo.org>
121```
122
123## Requirements for Android-specific patches: `ANDROID:`
124
125- If the patch is fixing a bug to Android-specific code
126 - tag the patch subject with `ANDROID:`
127 - add a `Fixes:` tag that cites the patch with the bug
128 - Example:
129```
130 ANDROID: fix android-specific bug in foobar.c
131
132 This is the detailed description of the important fix
133
134 Fixes: 1234abcd2468 ("foobar: add cool feature")
135 Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01
136 Signed-off-by: Joe Smith <joe.smith@foo.org>
137```
138
139- If the patch is a new feature
140 - tag the patch subject with `ANDROID:`
141 - add a `Bug:` tag with the Android bug (required for android-specific features)
142
aksys-devc2e1ecf2021-02-18 13:26:17 +0800143# Vibrator driver for HHG device
144## How to merge the driver into kernel source tree
145
146 1. Copy \${this_project}/drivers/hid/hid-aksys.c into \${your_kernel_root}/drivers/hid/
147
148 2. Compare and merge \${this_project}/drivers/hid/hid-ids.h into \${your_kernel_root}/drivers/hid/hid-ids.h :
149 Add the following code before the last line of this file
150
151 ```c
Daniel65a82ee2021-02-18 15:08:52 +0800152 #define USB_VENDER_ID_QUALCOMM 0x0a12
153 #define USB_VENDER_ID_TEMP_HHG_AKSY 0x1234
154 #define USB_PRODUCT_ID_AKSYS_HHG 0x1000
aksys-devc2e1ecf2021-02-18 13:26:17 +0800155 ```
156
157 3. Merge \${this_project}/drivers/hid/Kconfig into \${your_kernel_root}/drivers/hid/Kconfig :
158Add the following code before the last line of this file
159
160 config HID_AKSYS_QRD
161 tristate "AKSys gamepad USB adapter support"
162 depends on HID
163 ---help---
164 Support for AKSys gamepad USB adapter
165
166 config AKSYS_QRD_FF
167 bool "AKSys gamepad USB adapter force feedback support"
168 depends on HID_AKSYS_QRD
169 select INPUT_FF_MEMLESS
170 ---help---
171 Say Y here if you have a AKSys gamepad USB adapter and want to
172 enable force feedback support for it.
173
174 4. Merge \${this_project}/drivers/hid/Makefile into \${your_kernel_root}/drivers/hid/Makefile :
175 Add the following code at the end of this file
176
177 obj-$(CONFIG_HID_AKSYS_QRD) += hid-aksys.o
178
179 5. Modify your kernel's default build configuration file. Add the following two lines:
180
181 CONFIG_HID_AKSYS_QRD=m
182 CONFIG_AKSYS_QRD_FF=y