Skip to content

Instantly share code, notes, and snippets.

@haxpor
Last active November 3, 2021 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haxpor/f55a2fe47c5bfddfb81c2696a2646a9e to your computer and use it in GitHub Desktop.
Save haxpor/f55a2fe47c5bfddfb81c2696a2646a9e to your computer and use it in GitHub Desktop.
Note on linux kernel patch submission

Prepare a patch

  • Set up your email client properly Better to set inside the each local git project's .git/config instead of all-in-one globally at ~/.gitconfig as each project might need different account / credential. Add the following (in this case we use mutt, just take advantage of certificates as used by it for ease of integration)

    [sendemail]
      from = FirstName Lastname <email@domain.com>
      smtpEncryption = tls
      smtpuse = email@domain.com
      smtpserver = mail.domain.com
      smtpserverport = <portnumber>
      smtpAuth = LOGIN
      smtpsslcertpath = ~/.mutt/certificates
    
  • Make changes to linux kernel code

  • Generate patch file with git format-patch HEAD~ or git format-patch HEAD~<number-of-commits>

  • Lint the patch with ./scripts/checkpatch.pl <your-patch-filename>.patch

  • Send the email with

    git send-email <your-patch-filename>.patch --to-cmd='./scripts/get_maintainer.pl --norolestats <your-patch-filename>.patch' --cc "additional@people.com" --cc "additional2@people.com"
    
  • Hit y for send.

Resend the patch (ping the maintainers)

  • Send email with the following command
    git send-email <your-patch-filename>.patch --to-cmd='./scripts/get_maintainer.pl --norolestats <your-patch-filename>.patch' --cc "additional@people.com" --cc "additional2@people.com"
    
  • Hit e to edit the patch.
  • Edit the title from [PATCH] to [PATCH RESEND], save then exit.
  • Hit s to send the patch.

Send a patch series with multiple .patch files (as we have multiple commits)

  • Send email with the following command

    git format-patch --cover-letter HEAD~<number-of-commit>` or `git format-patch --cover-letter master..feature
    

    Use HEAD~<number-of-commits> to explicitly specify number of commits we have created preparing for a patch series, or use difference between current branch master against the branch you're working on feature.

  • ... same workflow with others

Send incremental patch

  • git format-patch -v2 HEAD~ or git format-patch -v2 HEAD~<number-of-commits> -v2 here is the version number of the patch.
  • ... same workflow with others
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment