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