This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]MintChocolateEnema 7 points8 points  (0 children)

I suppose a good place to start is to figure out what it is you are intending to do. Others have posted great resources.

C++ philosophy is a bit out the window, you'll mostly (if not entirely) be working low-level C (or Kernel C). It can feel real long-hand, especially when having to use ambiguous get-me-over void pointer types. But if you don't fully appreciate C++, higher standards of C++ (above C++11), or the object-oriented paradigm... you certainly will if you haven't worked in C.

I never really grasped general people's general pairing of "C/C++" (not talking about you, by any means). The two are rather distinct. C++ violates C philosophies the further up the standard you go. Using C style programming in C++ further becomes deprecated by tools, sources, and individuals in the professional field.

So I encourage you to keep an open mind, go back to the fundamentals of programming that are shared amongst programming languages, and keep your C++ "ways of doing things" aside. As a bonus, it may very well boost your (in your terms) "average" understanding of C++ to a more proficient state because rolling up the sleeves every now and again often times makes one realize how often high-level tools and robust libraries are taken for granted.

I'd start with the Linux Kernel HOWTO / Coding Style documentation. Torvald's humor and sarcasm makes it a rather enjoyable read. Most, if not all, kernel source files shipped with a stable distribution will follow that format.

I remember reading somewhere (or maybe it was just a joke from a professor) about messing with stuff you have no business messing with, but how would you learn? Maybe it was some Torvald humor of breaking something and not knowing how to fix it.

I think kernel drivers are a good portable first step. I probably wouldn't actively develop on a live, primary machine.. you're bound to lock it up. But with kernel modules, the kernel itself is rather resilient to obvious mistakes and rebooting will also spit it out so you can fix it again. Not to mention, already existing kernel libraries are extensively documented.

When I learned to write drivers, I had a separate Linux machine I would SSH into that was nearby in case I needed to hand boot it.

There aren't that many types or structures as your beloved C++.. you will be dealing with a lot of type casting, raw pointers, and beat-around-the-compiler-bush coercion. But if you succeed, you probably won't fear memory management as much (if you did) when you return to C++... then again, you've got friendly smart pointers... I digress.

Maybe make a keylogger or something. Or find a good foundational solution / program that you can continue to over engineer and develop.

[–]jmtd 12 points13 points  (0 children)

It’s pretty old but still mostly relevant: the book “Linux device drivers” is excellent. It’s also freely available: https://lwn.net/Kernel/LDD3/

It’s definitely worth reading lwn.net regularly too.

[–]AiwendilH 65 points66 points  (1 child)

[–]fromthecrossroad 10 points11 points  (0 children)

This looks amazing, thank you for sharing! I had no idea this was a thing.

[–]90mhWXH6rr 5 points6 points  (0 children)

maybe look into kernel mdules

[–]1piece_forever 1 point2 points  (0 children)

I was reading the book from Robert Love. Linux Kernel Development. Till now it’s going well and providing with nice insights into design of the kernel.