things you need to know to submit a linux kernel patch · > 1. do you want to go out to lunch...

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

Upload: others

Post on 05-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Things you need to know to submit a Linux kernel patch · > 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

Things you need to know to submit a Linux kernel patch

Sayli Karnik

Page 2: Things you need to know to submit a Linux kernel patch · > 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

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

Maintainer Model

DeveloperDeveloper

DeveloperDeveloper

DeveloperDeveloper

Maintainer

Maintainer

Maintainer

Maintainer

Maintainer

15600 coders!

Page 4: Things you need to know to submit a Linux kernel patch · > 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

Wouldn’t it be great to have a patch merged into the kernel?!

Page 5: Things you need to know to submit a Linux kernel patch · > 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

Contributing to the kernel

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

Page 6: Things you need to know to submit a Linux kernel patch · > 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

Contributing to the kernel

• Step 2Linux kernel code repository

Copy your current config

Page 7: Things you need to know to submit a Linux kernel patch · > 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

Contributing to the kernel

• Step 3Build/Install your kernel

Page 8: Things you need to know to submit a Linux kernel patch · > 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

Contributing to the kernel

• Step 4• Make your branch

• Update your kernel

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

Page 9: Things you need to know to submit a Linux kernel patch · > 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

Contributing to the kernel

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

0001-xyz.patch

Page 10: Things you need to know to submit a Linux kernel patch · > 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
Page 11: Things you need to know to submit a Linux kernel patch · > 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

Contributing to the kernel

• Step 5.. Shoot the email

Page 12: Things you need to know to submit a Linux kernel patch · > 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

What can I change in the kernel?• Starters

– Code cleanups

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

Page 13: Things you need to know to submit a Linux kernel patch · > 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
Page 14: Things you need to know to submit a Linux kernel patch · > 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
Page 15: Things you need to know to submit a Linux kernel patch · > 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

What can I change in the kernel?

• 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 16: Things you need to know to submit a Linux kernel patch · > 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

What can I change in the kernel?

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

@depends on i@type T; T[] E; @@

- (sizeof(E)/sizeof(*E)) + ARRAY_SIZE(E)

Page 17: Things you need to know to submit a Linux kernel patch · > 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

What can I change in the kernel?...

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

• TODOs

Page 18: Things you need to know to submit a Linux kernel patch · > 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

What can I change in the kernel?...

• Read kernel mailing archives [email protected]

• Go through the git log to see commits

Page 19: Things you need to know to submit a Linux kernel patch · > 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

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 20: Things you need to know to submit a Linux kernel patch · > 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

Revising your patch

Page 21: Things you need to know to submit a Linux kernel patch · > 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

May the source be with you J

http://karniksayli.wordpress.com/[email protected]