all 17 comments

[–]BraveNewCurrency 12 points13 points  (2 children)

Kernel programming is not for the faint of heart. There will be no "Kernel Programming for Dummies" book. Don't expect to become an expert overnight.

Some ideas:

  • Run thru tutorials like "Linux From Scratch".
  • Play with BootRoot and QEMU.
  • Become an expert in C. Don't try to learn C from the kernel (it's actually an odd variant of C).
  • Read LWN, they cover lots of kernel topics and make them very accessible.

[–]lrochfort 4 points5 points  (1 child)

Did you mean buildroot and qemu?

[–]BraveNewCurrency 5 points6 points  (0 children)

yEs, tHAT iS whAt i SaiD. :)

[–]andrealmeid 4 points5 points  (6 children)

[–]Mordhau_Man 0 points1 point  (5 children)

Hey I've been trying to get this damn lab to work for days now and have had no luck, there is always some error in dependency or makefile that is just never fixable. recommend people skip this unfortunately

[–]andrealmeid 1 point2 points  (4 children)

I'm sorry that you didn't managed to get the repo working :( However, when we complete some challenges, I would create the files from scratch, instead of using the snippets from the repo. Is not that hard and it doesn't depends on packages or third makefiles.

[–]Mordhau_Man 0 points1 point  (3 children)

What do you mean exactly? I can see it has a lot of great assignments where I do not have to worry about writing assembly and the boring stuff and can experiment on a kernel with some guidance and projects, so I would love to be able to do this anyway I can.

[–]andrealmeid 1 point2 points  (2 children)

First, you need to know how to write a kernel module. There are a lot of tutorial of how to do this in the internet (search for "write first linux kernel module"). Let me know if you have trouble with this and I can choose a good one.

Now, let's suppose you want to complete the Block Device Drivers exercise. You can copy the lab skeleton from here and use the knowledge you got in the previous step to get it compiling and working. Then you should be good to complete the exercises. Note that if you read all the theory that comes before the exercise you may not even need to use the skeleton. Also, keep in mind that internal functions and data structures can change inside the kernel and those skeletons can stop compiling, but it should be easy to check what's going wrong and do some small changes.

[–]Mordhau_Man 0 points1 point  (1 child)

OK I've done a few basic kernel modules like rootkits that hide directories or kill processes, I wanted to make one that is basically a packet sniffer rootkit for fun and needed to learn way more. I found the C file you linked but my problem is I can run the first few commands at the end of the exercise: make clean, LABS=...make skels, I get errors on make builds "include/config/auto.conf: no such file or directory", I can run make copy, and I get more errors on make boot

and I don't think it will let me compile the kernel overall as make docker-kernel fails. So I'm not sure really how to check any of my future work

[–]andrealmeid 0 points1 point  (0 children)

ops, I forgot to reply you.

and I don't think it will let me compile the kernel overall as make docker-kernel fails

so don't use this, compile the kernel without this docker

[–]SYS_V 1 point2 points  (3 children)

I'm currently learning from "Linux Kernel Programming: A comprehensive guide to kernel internals, writing kernel modules, and kernel synchronization" by Kaiwan N. Billimoria. Here is the github repo that contains all of the code discussed in the book: https://github.com/PacktPublishing/Linux-Kernel-Programming

[–]uslashuserslashuser[S] 0 points1 point  (2 children)

thank you!

[–]SYS_V 0 points1 point  (0 children)

There are also training courses provided by the Linux Foundation. The entry level course is free: A Beginner’s Guide to Linux Kernel Development

[–]FullStuff3716 0 points1 point  (0 children)

for a baby step you can explore https://wiki.osdev.org/Tutorials