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 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


References:


Featured Video:

(API) Watch Video: 0x1a9 Become a Windows or a Linux Programmer ? || The Linux Channel
0x1a9 Become a Windows or a Linux Programmer ? || The Linux Channel
* Click the image to watch this video on Youtube ↗


Suggested Topics:


Network Software Development:
C code to check valid IP Address (IPv4) - Live Demo and Example ↗
18-Jun-2018

Tail Drop - by Network Schedulers to Drop Packets in Network Appliances ↗
27-Jun-2018

UDP sample socket code for Systems and Network software developers ↗
02-Feb-2017

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

Bufferbloat in a Networking Device or an Appliance ↗
27-Jun-2018

Introduction to Network Processors (NPU) ↗
03-Nov-2019

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

Data-Plane and Control-Plane of a Networking Device ↗
30-Oct-2019


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

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

Difference between Intel Xeon Server vs Desktop Core i7 vs Intel Mobile Atom vs ARM Processors ↗
19-Jun-2018

Research Socket overhead in Linux vs Message Queues and benchmarking ↗
21-Jun-2017

Tour of my new Home Networking Lab within VirtualBox VM ↗
16-May-2017


Linux (user-space), Systems Architecture:
Coding a simple look-up-table in C - without Linked lists and a binary search ↗
17-Jun-2018

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

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

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

Linux user-space Atomic Operations via GCC Atomic builtins ↗
22-Mar-2017

C code to read a /proc file in Linux user-space - Live Demo and Example ↗
11-Jun-2018

A Linux system call in C without a standard library ↗
10-Mar-2017

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


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

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

Linux Networking Stack :: RFS: Receive Flow Steering ↗
09-Dec-2017

How to submit your Linux Kernel Patch ↗
07-Feb-2017

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

KERNEL - The Linux Channel - a High Performance Linux Kernel ↗
12-Dec-2018

Tracking code changes in Linux Kernel Source code ↗
19-Nov-2018


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

Linux Kernel Internals :: Implementing a Linux Kernel System Call ↗
03-May-2019

Linux Kernel Internals :: Linux Kernel Development ↗
03-May-2019


Software Development (Programming) Tools:
What is a Toolchain | gcc Cross-Compiler | Libraries | BSP (Board Support Package) | Embedded ↗
24-Jun-2019

SNMP and MIB Browsers ↗
12-Feb-2019

What is a BSP | Board Support Package | Big Picture | Embedded Systems Software Development ↗
24-Jun-2019

Kompare GUI patch and diff tool in Linux ↗
19-Jun-2018

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. ↗
19-Jun-2018


Embedded Projects:
GPS Geo-tracking system using LinkIt ONE ↗
11-Jan-2017

Using a GPS Sensor ↗
28-Jul-2017

 

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:
SanDisk Cruzer Blade 32GB USB Flash Drive
Buy at Amazon Buy at Amazon

Featured Video:
(API) Watch Video: 0x18b Network MTU and Path MTU Discovery PMTUD | WAN and Internet Performance Optimization - Part2
0x18b Network MTU and Path MTU Discovery PMTUD | WAN and Internet Performance Optimization - Part2
* Click the image to watch this video on Youtube ↗

Download: Linux Kernel System Call.pdf


Trending Video:
(API) Watch Video: 0x1c4 Texas Instruments BroadBand SoC TNETV1055 MIPS32 4KEc V4.8 | BusyBox Embedded Linux | VLOG
0x1c4 Texas Instruments BroadBand SoC TNETV1055 MIPS32 4KEc V4.8 | BusyBox Embedded Linux | VLOG
* Click the image to watch this video on Youtube ↗

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


Linux Kernel Programming - Device Drivers:


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


Recommended Video:
(API) Watch Video: 0x1cf It is not HR who hires you ! #TheLinuxChannel #KiranKankipati
0x1cf It is not HR who hires you ! #TheLinuxChannel #KiranKankipati
* Click the image to watch this video on Youtube ↗