How to submit patches to Linux Kernel

Source: Internet
Author: User
Tags andrew morton call back

Last night, I finally submitted the first Patch in my life, I woke up this morning and couldn't wait to see my cell phone, and I found that the maintainer Andrew Morton me at 6:31: I was The patch has been added to the -mm tree. suddenly excited. Although this Patch has no technical content, at least this is what I found in the process of reading the code, and finally realized the feeling of progress. Below I will record the steps of Patch submission, also for others to refer to.

Git Email Configuration

To make sure that the Patch format is sent without errors, we use the commands provided by Git itself git send-email .

Installation git send-email

I use Fedora, install the command for sudo dnf install git-email , other system please use it yourself yum or apt .

Configuration git-emailUse the Gmail email service

git-email   Use Gmail to provide a mailbox service, in other words  git-email   is just a mail sending client, and the real job needs to be done by Gmail.

  1. Open a Git configuration file

    vim ~/.gitconfig

  2. Append the following to the end of the file

    [Sendemail]from = My Name <[email protected]>smtpserver = smtp.gmail.comsmtpuser = [email protected]smtpencryption = Tlssmtppass = My_gmail_passwordchainreplyto = Falsesmtpserverport = 587


Modify the code tree and build a patch to create a new branch

This is handy for generating patches later, using the following commands:

git branch develop git checkout develop
Modifying the Kernel code tree

It's up to you to change what you're doing.

Submit Changes
git Add. Git commit-s-V

Attentiongit commitThe command automatically opens the editor for you to edit the Commit message,-sParameter can automatically add a line to your Commit messageSigned-off-by: My Name <[email protected]>-vThe parameters will show the changes you made below your Commit message, making sure you can check your changes repeatedly, which is not required, but recommended.

Note that the format of the Commit information is strictly limited, I will not nonsense, directly on the template.

mm: fix some errorwhy i do these changes and how i do  it. Signed-off-by: my name <[email protected]> 
    1. The first part is short description, to the subsystem name, such as MM, notice the semicolon after a space, do not know the subsystem name can see you modify the file modification history, See how the previous developer wrote it. This section needs to use a short sentence to describe the changes you have made, so that the maintainer can see at a glance what the Patch is probably doing.

    2. The second part is the body of your patch, which explains in detail why you want to make this change, and how to do it, notice the tense with the present tense and the active form of the voice.

    3. The third part is the previous  -s   Parameters automatically added, no tube.

    4. It is important to note that there is a blank line between the three parts.

If you commit want to modify the Commit message later, you need to use the command git commit --amend -v .

Generate Patches

Now that the changes have been committed, it's time to generate patches.

Git Format-patch Master

This command is based on the master branch and detects the changes you made in the current develop branch and generates a Patch file.

Once the command is complete, you will be able to see your Patch file.

[[email protected] linux]$ ls *.patch0001-mm-fix-some-error.patch
Check your Patch format

Run the following command to check your Patch format for any problems to do 0 errors, 0 warnings .

./scripts/checkpatch.pl 0001-mm-fix-some-error.patch
Send Patch

Now that Patch has been generated, it's time to send it to the upstream maintainer.

Find out who should be sent

Run the following command to find out who you should send the Patch to.

./scripts/get_maintainer.pl-f Include/linux/gfp.h

Note that include/linux/gfp.h this file name is changed to the file you modified.

In my case, the command output is as follows:

Andrew Morton <[email protected]> (commit_signer:7/8=88%) Michal Hocko <[email protected]> (commit_signer:3 /8=38%,authored:1/8=12%,added_lines:3/21=14%,removed_lines:10/33=30%) Vlastimil Babka <[email protected]> ( commit_signer:3/8=38%,authored:1/8=12%,added_lines:8/21=38%,removed_lines:6/33=18%) Alexander Duyck <[email Protected]> (commit_signer:3/8=38%,authored:3/8=38%,added_lines:6/21=29%,removed_lines:5/33=15%) Mel Gorman <[email protected]> (commit_signer:2/8=25%) Vladimir Davydov <[email protected]> (authored:1/8=12%, removed_lines:9/33=27%) My Name <[email protected]> (authored:1/8=12%,added_lines:2/21=10%,removed_lines:2/33 =6%) [email protected] (open list:memory MANAGEMENT) [email protected] (open list)
Test send

For beginners like me, it's best to take a test of your own mailbox before sending it to an upstream maintainer, and it's not bad to be careful.

git send-email--to [email protected] 0001-mm-fix-some-error.patch

Everything is OK, you should be able to receive the mail, check the format of what is the same as you expected.

Official send
git send-email--to [email protected]--cc [email protected]--cc [email protected]--cc [email protected]--cc [email Pro  Tected]--cc [email protected]--cc [email protected]--cc [email protected]--cc [email protected]--cc [email protected] 0001-mm-fix-some-error.patch

Your Patch is then sent to the upstream maintainer and copied to the corresponding mailing list.

Subsequent

Quietly waiting for the maintainer's email notification, if the Patch into the upstream branch will send you an email notification, if the call back will also tell you where the wrong. I'll write this part later when I submit a patch for a complex point.


This article is from the "Linux Kernel Developer" blog, so be sure to keep this source http://mirage1993.blog.51cto.com/2709744/1912785

How to submit patches to Linux Kernel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.