The Linux Channel

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 which is present in your kernel source tree scripts/

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/ 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:
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions
Shyam Saini Kernel patch submissions


Featured Video:

* Click the image above to watch this video on Youtube ↗

Suggested Topics:

Network Software Development:
 UDP sample socket code for Systems and Network software developers ↗

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

 Bufferbloat in a Networking Device or an Appliance ↗

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

 iPerf tool - for network channel analysis, bandwidth tests and system & network benchmarking ↗

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

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:
 Coding a simple look-up-table in C - without Linked lists and a binary search ↗

 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 ↗

 Linux user-space Atomic Operations via GCC Atomic builtins ↗

 A Linux system call in C without a standard library ↗

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

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

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

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

 Linux Networking Stack :: RFS: Receive Flow Steering ↗

 How to submit your Linux Kernel Patch ↗

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

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

 Tracking code changes in Linux Kernel Source code ↗

 KERNEL - The Linux Channel - a High Performance Linux Kernel ↗

Linux Kernel Internals (PDFs) - by Ramin Farajpour:
 Linux Kernel Internals :: Linux Kernel Boot Process ↗

Software Development (Programming) Tools:
 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. ↗

 Kompare GUI patch and diff tool in Linux ↗

 SNMP and MIB Browsers ↗

Embedded Projects:
 Using a GPS Sensor ↗

 GPS Geo-tracking system using LinkIt ONE ↗


Join The Linux Channel :: Facebook Group

Join a course:

💎 Linux, Kernel and Network Software Developer: PDF Brochure
💎 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:

* Click the image above to watch this video on Youtube ↗

Download: Linux Kernel Booting_1.pdf

Trending Video:

* Click the image above to watch this video on Youtube ↗

TUTORIALS :: Linux Networking Stack :: RFS: Receive Flow Steering:

Linux Kernel TCP Congestion Control Algorithms:
Linux Kernel Programming - Device Drivers:

Research :: Content Delivery Networks (CDN):
CDN Networks

Recommended Video:

* Click the image above to watch this video on Youtube ↗

The TOFFEE Project - v10.20 :: Updated: 27-Feb-2019 :: © 2019 :: Author: Kiran Kankipati
Your IP: :: Browser: CCBot/2.0 (