things you need to know to submit a linux kernel patch

21
Things you need to know to submit a Linux kernel patch Sayli Karnik @SayliKarnik

Upload: others

Post on 20-Apr-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Things you need to know to submit a Linux kernel patch

Things you need to know to submit a Linux kernel patch

Sayli Karnik

@SayliKarnik

Page 2: Things you need to know to submit a Linux kernel patch

The Linux kernel

• One of the biggest and fastest moving open source project • 53600 files, >2M Loc

Page 3: Things you need to know to submit a Linux kernel patch

Maintainer Model

Developer

Developer

DeveloperDeveloper

Developer

Developer

Maintainer

Maintainer

Maintainer

Maintainer

Maintainer

15600 coders!

Page 4: Things you need to know to submit a Linux kernel patch

Contributing to the kernel

• Step 1• Install Ubuntu/Debian• Setup tools:Editor (Eg. vim, gedit etc)Email client (Eg. Mutt)VCS (git)

Page 5: Things you need to know to submit a Linux kernel patch

• Step 2Linux kernel code repository

Copy your current config

Page 6: Things you need to know to submit a Linux kernel patch

• Step 3Build/Install your kernel

Page 7: Things you need to know to submit a Linux kernel patch

• Step 4• Make your branch•

Update your kernel

• Make changes //TODO (brb!)• Re-Compile

Page 8: Things you need to know to submit a Linux kernel patch

• Step 5 - Get, set, go! ~> Commit, patch, email

0001-xyz.patch

Page 9: Things you need to know to submit a Linux kernel patch
Page 10: Things you need to know to submit a Linux kernel patch

• Step 5.. • Step 5.. Shoot the email

Page 11: Things you need to know to submit a Linux kernel patch

What can I change in the kernel?

• Starters– Code cleanups

https://elixir.bootlin.com/linux/latest/source/Documentation/process/coding-style.rst

Page 12: Things you need to know to submit a Linux kernel patch
Page 13: Things you need to know to submit a Linux kernel patch
Page 14: Things you need to know to submit a Linux kernel patch

Some other coding style rules:• Meaningful names: cntusr() count_users() • Not more than 80 columns• Indentations/spaces/braces• Avoid typedefs• Standard commenting style• Use existing macros

Page 15: Things you need to know to submit a Linux kernel patch

• Coccinelle can help!(pattern matching and transformation tool)Example:

@depends on i@ type T; T[] E; @@ - (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E)

Page 16: Things you need to know to submit a Linux kernel patch

@ disable isnt_zero @ expression *E; @@ E != - 0 + NULL

• TODOs

Page 17: Things you need to know to submit a Linux kernel patch

• Read kernel mailing archives [email protected]

• Go through the git log to see commits

Page 18: Things you need to know to submit a Linux kernel patch

Revising your patch• Do not top-post to ask questions!Mark,Lunch tomorrow sounds great! Let’s keep it simple and get a pepperoni pizza.> On Fri, Apr 26, 2013 at 9:25 AM, Mark wrote:> Hey John, I had some questions I wanted to ask you:> 1. Do you want to go out to lunch with me tomorrow?> 2. What’s your favorite type of pizza?> 3. You’re paying this time, right?

Mark,See my answers below…> On Fri, Apr 26, 2013 at 9:25 AM, Mark wrote:> Hey John, I had some questions I wanted to ask you:> 1. Do you want to go out to lunch with me tomorrow?Lunch tomorrow sounds great!> 2. What’s your favorite type of pizza?Let’s keep it simple and get a pepperoni pizza.> 3. You’re paying this time, right?You bet! You paid last time so it’s my turn.

answer

questions

Inline replies

Page 19: Things you need to know to submit a Linux kernel patch
Page 20: Things you need to know to submit a Linux kernel patch

For further questions reach out to me at - [email protected]://karniksayli.wordpress.com/

Page 21: Things you need to know to submit a Linux kernel patch