r/linuxquestions • • May 24 '21

To all the Linux kernel devs and contributors

  1. how did you start learning kernel Dev

  2. what mistakes would you avoid if you were to start all over again

  3. what are the best resources to learn Linux kernel dev

  4. what are the requisite/must knows/stuff nobody tells you about kernel dev

All suggestions are welcome. Thanks in advance.

222 Upvotes

16 comments sorted by

4

u/[deleted] May 25 '21

Are you just curious, or do you want to go into kernel development?

I don't want to discourage you, but if it's the latter, and you ask those questions, you probably aren't ready. The kernel is very complex, it's not something that you can just dive into.

If you just want to help, you should probably pick some simpler projects. Just to start somewhere. You don't go into quantum physics before learning calculus.

You should go into kernel development if:

  • you're already writing low-level code

  • (and you want/need to write a driver for some hardware)

  • you already have an idea of what you can fix/improve from experience

  • you know C very well and you're a very experienced programmer, so you can look for things you can fix/improve

I'm neither of those, so I don't try to fix what's not broken, and as an experienced devops and not so experienced developer, I just use the software and occasionally report bugs. Because I either don't have the time to figure it out myself, or I lack experience.

Not everyone gets to be a kernel developer, and neither they have to.

3

u/[deleted] May 25 '21

you're already writing low-level code

Low level code as in assembly level language?

1

u/kokoseij May 25 '21

C codes that directly interact with hardware components, I'd assume.

1

u/[deleted] May 25 '21

Uhh,very well,thank you for your detailed explanation

2

u/[deleted] May 25 '21

Not necessarily. C is already considered a low-level language.

I've been writing firmware for portable gas analyzers and radiation meters back in the day, and it was mostly just C. The only use for assembly was switching the microcontroller's modes to put it into sleep and back. This and some optimizations for displaying icons/fonts on the display (a simple monochrome 128x64 one, I had to address the buffers directly).

6

u/bmwiedemann openSUSE Slowroll creator May 25 '21

First and foremost, have a purpose.

When I started to write Kernel code around 2000, I needed a filesystem overlay to write to CD-ROMs - a notoriously read-only media.

I of course did the code in the wrong place, so never even tried to upstream it, so it stopped working when 2.6 kernels changed the rules. Would be better to add the right code in the right place, but to find that, you have to read and talk a lot to others working on that code.

3

u/Consistent_Mirror May 24 '21

remindme! 20 days

0

u/[deleted] May 24 '21

[deleted]

20

u/Vlad_The_Impellor May 24 '21

Nailed it. It also helps to understand (at the flyover level) how the GNU C compiler, assembler, and linker work, plus all the other tools commonly used in the build process. Build the current kernel in one job. Note the commands being run and skim their man pages.

You also have to know vi or emacs, and develop/hold an obsessive opinion about your choice which you must be willing to defend. Buy a white robe with brown belt, watch Bruce Lee movie, practice the moves.

6

u/blockjoe May 24 '21

I've noticed I tend to learn well via the "learn by doing" method. I've learned a lot of what I know by having some, sometimes contrived, problem I want a solution for, and I learn by executing on that solution.

A problem I've had, is that I don't have enough understanding to figure out what would be a simple, but illustrative enough of an example to dive into.

Is there anything that you would suggest as a "Hello World!" of device drivers? While I have a bunch of unsupported devices sitting around, I don't think looking at a device that I don't have the spec for and trying to just power my way through an implementation is something that's going to be successful.

5

u/vishwajith_k May 24 '21

Hello world of LDD here https://lwn.net/Kernel/LDD3/ apis are expiring! You need search and replace for a newer kernel; book was written for something may be 2.6

0

u/[deleted] May 24 '21

[deleted]

45

u/edparadox May 24 '21

Please, do not talk about something you do not know the first thing about.

4

u/r_phone May 25 '21

Most people look for vulnerabilities in the kernel s

You are suggesting a new bie to look for vulnerability.

Ok

8

u/Toucan2000 May 24 '21

Why

23

u/vesterlay May 24 '21

Unreliable opinion is worthless and potentially harmful.

18

u/Atemu12 May 24 '21

worthless and potentially harmful

Reddit in a nutshell.

-5

u/[deleted] May 24 '21 edited Apr 27 '24

snatch worry escape rhythm violet foolish dinner wine square vast

This post was mass deleted and anonymized with Redact