TUTORIALS :: How to submit your Linux Kernel Patch

Written by: Shyam Saini, edited by Kiran Kankipati - Published: 07-Feb-2017

If you are a newbie or even an experienced programmer you might have stumbled at kernel newbies page which is heaven for all those who are willing to involve in Linux kernel development. Today I'm writing about linux kernel patch Philosophy. Oh yes, You are right submitting kernel patches is none less than a Philosophy.

In fact there is a good post about Patch Philosophy.

It is more about Linux development culture which follows certain rules and norms for the patch and if you are newbie you better follow this culture to make your life easier.

Scared or Worried? Don't worry. Rule of the game is:

  • be patient
  • read blogs written by various developers to get the bigger picture
  • ask your queries on kernelnewbies mailing list. But again do your research first. That will help you a lot.

Kernel maintainers stay very busy and receive many patches in a single day. Obviously you won't like to make bad impression by sending wrong/invalid patches. Here wrong/invalid has huge meaning. I'll try to state all those:

* patch which is not tested
> Never send a patch which is not built successfully.

* patch built(compiled) against wrong wrong tree or outdated tree.
> Newbies are most prone to do these mistakes.

* why should you bother about these trees?
> It might happen that the patch which you are sending is already been sent by someone else and thus your patch would be of no use.
> And It may happen the maintainer won't reply for such obsolete patch.

* which git tree to use ?
> Always use linux-next tree unless and until it is explicitly mentioned to use other trees.
> Sometimes we might need to work against different trees of different subsystems. Again always choose trees ending -next*.

For more details about -next* kindly read this document.
* Never send patch or patch-set with exactly same commit header or similar commit.
> Commit header lets the other developers what changes has been made in two or more constructive commits. For example:

[PATCH 1/3] dgnc: Fix the Z
[PATCH 2/3] dgnc: Fix the Z
[PATCH 3/3] dgnc: Fix the Z

or say for example:
[PATCH 1/3] dgnc: Fix the Z
[PATCH 2/3] dgnc: Z is fixed

*So what is the right way?
> Whenever you get stuck in such a situation where you are fixing same thing but in different files of same subsystem or driver then always try to send all the changes in a single patch instead of sending different patches with same or similar commit header.

Last but not least, after building and testing always check you patch with following scripts checkpatch.pl which is present in your kernel source tree scripts/checptach.pl

Here is an example where I've tested a patch named 0001-qed-Replace-memset-with-eth_zero_addr.patch

mystictot (my-1016) linux-tree $ ./scripts/checkpatch.pl 0001-qed-Replace-memset-with-eth_zero_addr.patch 
total: 0 errors, 0 warnings, 0 checks, 33 lines checked

0001-qed-Replace-memset-with-eth_zero_addr.patch has no obvious style problems and is ready for submission.

So, if you get the same output as has no obvious style problems and is ready for submission, then everything is good with your patch. Now, you are all set to send your patch.

All the best ;)

For example here are my Kernel submission log screenshots:
Link: http://git.netfilter.org/iptables/log/?qt=grep&q=shyam+saini
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions


Featured Video:

Suggested Topics:

Network Software Development:
iPerf tool - for network channel analysis, bandwidth tests and system & network benchmarking ↗

Layer-2 (L2) Multicast Frame Deep Analysis ↗

TCP vs UDP an Expert Opinion ↗

UDP sample socket code for Systems and Network software developers ↗

Network MTU and Path MTU Discovery PMTUD - WAN and Internet Performance Optimization ↗

Introduction to Network Processors (NPU) ↗

Design & Architecture of custom Dynamic Routing Protocols ↗

TCP Link Bonding vs Multipath TCP (MPTCP) ↗

Socket Options - Socket Programming - setsockopt(), getsockopt() ↗

C code to check valid IP Address (IPv4) - Live Demo and Example ↗

Bufferbloat in a Networking Device or an Appliance ↗

Data-Plane and Control-Plane of a Networking Device ↗

Tail Drop - by Network Schedulers to Drop Packets in Network Appliances ↗

Research and Projects:
Data Profiling and Visual Analysis tool for Deep Learning and AI - VLOG - The Linux Channel ↗

CYRIL ING√ČNIERIE - CoreFreq Linux CPU monitoring software ↗

Difference between Intel Xeon Server vs Desktop Core i7 vs Intel Mobile Atom vs ARM Processors ↗

Research Socket overhead in Linux vs Message Queues and benchmarking ↗

Tour of my new Home Networking Lab within VirtualBox VM ↗

Linux (user-space), Systems Architecture:
C code to read a /proc file in Linux user-space - Live Demo and Example ↗

Linux user-space - Shared Memory IPC - Live Demo and Example ↗

Synchronization in Linux user-space - Architecting multi-process and multi-threads ↗

Linux user-space Pthread Synchronization via Mutex - Live Demo and Example ↗

Coding a simple look-up-table in C - without Linked lists and a binary search ↗

A Linux system call in C without a standard library ↗

Linux user-space Atomic Operations via GCC Atomic builtins ↗

Dynamic linking without STDLIB in Linux user-space C programming ↗

mmap() munmap() - map or unmap files or devices into memory ↗

Linux Kernel Software Development:
KERNEL - The Linux Channel - a High Performance Linux Kernel ↗

Tracking Linux Kernel bugs in Kernel.org Bugzilla (or Bugzee as we call it in the Industry) ↗

Linux Networking Stack :: RFS: Receive Flow Steering ↗

Kernel customization via make menuconfig - Linux Kernel Compilation (or a Kernel Build) ↗

Tracking code changes in Linux Kernel Source code ↗

How to upgrade or install a latest current release Linux Kernel version manually in Ubuntu? ↗

How to submit your Linux Kernel Patch ↗

Linux Kernel Internals (PDFs) - by Ramin Farajpour:
Linux Kernel Internals :: Implementing a Linux Kernel System Call ↗

Linux Kernel Internals :: Linux Kernel Development ↗

Linux Kernel Internals :: Linux Kernel Boot Process ↗

Software Development (Programming) Tools:
Kompare GUI patch and diff tool in Linux ↗

SNMP and MIB Browsers ↗

Bluefish IDE - a simple versatile light-weight best editor to edit kernel source files, html files, c source code, text files, SQL schema and so on. ↗

What is a Toolchain | gcc Cross-Compiler | Libraries | BSP (Board Support Package) | Embedded ↗

What is a BSP | Board Support Package | Big Picture | Embedded Systems Software Development ↗

Embedded Projects:
Using a GPS Sensor ↗

GPS Geo-tracking system using LinkIt ONE ↗

Join The Linux Channel :: Facebook Group

Join a course:

💎 Linux, Kernel, Networking and Device Drivers: PDF Brochure
💎 PhD or equivalent (or Post Doctoral) looking for assistance: Details
💎 ... or unlimited life-time mentorship: Details

💗 Help shape the future: Sponsor/Donate

Recommended Topics:
Featured Video:

Trending Video:

Download: Linux kernel Development.pdf

Recommended Video: