Todd Kjos | f8978f4 | 2019-10-24 17:07:24 -0700 | [diff] [blame^] | 1 | # How do I submit patches to Android Common Kernels |
| 2 | |
| 3 | 1. 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 | |
| 7 | 2. 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 | |
| 23 | Additional 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 <[email protected]> |
| 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 <[email protected]> |
| 46 | |
| 47 | Bug: 135791357 |
| 48 | Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 |
| 49 | (cherry-picked from c31e73121f4c1ec41143423ac6ce3ce6dafdcec1) |
| 50 | Signed-off-by: Joe Smith <[email protected]> |
| 51 | ``` |
| 52 | |
| 53 | - If the patch requires any changes from the upstream version, tag the patch with `BACKPORT:` |
| 54 | instead 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 <[email protected]> |
| 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 <[email protected]> |
| 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 |
| 75 | been 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 |
| 78 | must 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 <[email protected]> |
| 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 <[email protected]> |
| 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 <[email protected]> |
| 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:` |
| 107 | - add a `List:` tag with a link to the submittal on lore.kernel.org |
| 108 | - 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 <[email protected]> |
| 116 | |
| 117 | Bug: 135791357 |
| 118 | Link: https://lore.kernel.org/lkml/[email protected]/ |
| 119 | Change-Id: I4caaaa566ea080fa148c5e768bb1a0b6f7201c01 |
| 120 | Signed-off-by: Joe Smith <[email protected]> |
| 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 <[email protected]> |
| 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 | |