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