Ubuntu code patches guideline

Code patches applied to an Ubuntu kernel fall into two categories: cherry-pick/backport of upstream patches, or custom code changes that are not upstream yet / never will (we call the latter UBUNTU SAUCE patches).

For a detailed description on how to format patches before submission, see this guideline document, while here is a quick (and far from complete) introduction.

Upstream cherry-picks/backports

When cherry-picking an upstream patch, always use:

$ git cherry-pick -sx $PATCHSHA

and the resulting commit should like this:

commit c057fb5db41cafcc2ed8a72ce81627159316c2ba
Author: Stefan Binding <[email protected]>
Date:   Thu Jun 30 01:23:35 2022 +0100

ALSA: hda: cs35l41: Add module parameter to control firmware load

BugLink: https://bugs.launchpad.net/bugs/1995957

By default, the driver will automatically load DSP firmware
for the amps, if available. Adding this option allows the
autoload to be optional, which allows for different configurations.

Signed-off-by: Stefan Binding <[email protected]>
Signed-off-by: Vitaly Rodionov <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
(cherry picked from commit 622f21994506e1dac7b8e4e362c8951426e032c5)
Signed-off-by: Kai-Heng Feng <[email protected]>

pay particular attention to:

The BugLink line (must be manually added) points to a valid bug on Launchpad. Bugs on Launchpad contain a description of the issue, the reason to apply the submitted code, regression potential, etc - see also SRU template and this example.

The last Signed-off-by line (automatically added by git cherry-pick -s) defines the submitter of the change (not necessarily the author of the change, but whoever proposed the change to be included in the Ubuntu kernel).

The cherry picked line (automatically added by git cherry-pick -x) contains the original SHA of the upstream commit. In case the upstream source is linux-next, explicit it:

(cherry picked from commit 622f21994506e1dac7b8e4e362c8951426e032c5 linux-next)

And in case the provenance is anything but Linus tree or linux-next, explicit the source git tree in full:

(cherry picked from commit 622f21994506e1dac7b8e4e362c8951426e032c5 git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)

In case of a backport from a more recent kernel than the target, state it:

(backported from commit 622f21994506e1dac7b8e4e362c8951426e032c5 git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git)

The UBUNTU SAUCE

SAUCE patches follow the above rules, the main difference is in the subject line:

commit dc3163b33449199651660b6121571ef5081d79a3
Author: Wen Gong <[email protected]>
Date:   Fri Oct 28 13:07:06 2022 +0800
UBUNTU: SAUCE: wifi: ath11k: avoid deadlock during regulatory update in ath11k_regd_update()


BugLink: https://bugs.launchpad.net/bugs/1995041

...

(cherry picked from commit d99884ad9e3673a12879bc2830f6e5a66cccbd78 https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git master)

Signed-off-by: Aaron Ma <[email protected]>

where the prefix UBUNTU SAUCE is added in the patch subject.

Submitted patches that don’t follow these rules will likely be rejected.