![Page 1: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/1.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/2.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/3.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/4.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/5.jpg)
• Step 2Linux kernel code repository
Copy your current config
![Page 6: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/6.jpg)
• Step 3Build/Install your kernel
![Page 7: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/7.jpg)
• 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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/8.jpg)
• Step 5 - Get, set, go! ~> Commit, patch, email
0001-xyz.patch
![Page 9: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/9.jpg)
![Page 10: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/10.jpg)
• Step 5.. • Step 5.. Shoot the email
![Page 11: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/11.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/12.jpg)
![Page 13: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/13.jpg)
![Page 14: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/14.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/15.jpg)
• 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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/16.jpg)
@ disable isnt_zero @ expression *E; @@ E != - 0 + NULL
• TODOs
![Page 18: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/18.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/19.jpg)
![Page 20: Things you need to know to submit a Linux kernel patch](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/20.jpg)
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](https://reader034.vdocuments.mx/reader034/viewer/2022042421/6260027f097d2924343fcba5/html5/thumbnails/21.jpg)