First Linux Kernel Patch

Posted on by Ryan

First Kernel Patch

A while back I watched the “Write and Submit your first Linux kernel Patch” video on youtube and found it to be interesting. I followed the steps it descripted and got a few trivial patches accepted into the kernel. Below are a few things the video didn’t cover.

HowTo Documentation

The ‘HowTo’ documentation mentioned in the video can be found online at kernel.org. The directory its found in is loaded with useful information.

git

To configure git run the following commands.

git config –global user.name <your name>
git config –global user.email <your email>
git config –global color.ui true
git config –global core.editor <your choice>

This will create a file in your home directory with the name ‘.gitconfig’. To setup ‘git send-mail’ append the following to it.

[sendemail]
smtpencryption = tls
smtpserver = <mail.server.com>
smtpuser = ryan@desfo.org
smtpserverport = 587

In the video the patches were generated by running this.

git format-patch master..tutorial

I prefer to use the following command instead since it sends the files to the temp directory as well as only generates patches for the changes in the current branch (assuming you created a branch for the current set of changes).

git format-patch -o /tmp/ HEAD^

Additional Information

The Pro Git is a free book online and a recommended read for any one starting with git. If your looking to dive deeper into the linux kernel a list of resources can be found on the kernel newbies page.