5 ms·
Might be a bit controversial but I found writing drivers for Linux on my raspberry pi helped me understand kernels, virtual memory etc. I used Linux Device Driv
by lewis1028282 6y ago
Might be a bit controversial but I found writing drivers for Linux on my raspberry pi helped me understand kernels, virtual memory etc. I used Linux Device Drivers (ldd3) which is free online. The book was written for the 2.6 kernel but someone on GitHub updated the code for the latest kernels.
- stevekemp 6y agoI've never written a driver myself, because all my hardware is supported. But I've certainly added new PCI IDs to existing drivers, and done that kind of low-level learning. I expect if I found a random piece of hardware that was close to an existing one that adding the driver, or updating things so that it worked on the new hardware would be possible. It's just not a situation I've come across. What I found useful/educational was writing a simple linux security module. 1. LSMs are essentially isolated. 2. They don't care about hardware. 3. You can do lots of things with them. Even horrid evils things. For example I put together the following module in which the kernel calls back to userspace every single time you execute a binary, to decide whether it should be permitted or not: https://github.com/skx/linux-security-modules https://github.com/skx/linux-security-modules (And yes, I appreciate that is almost exactly as horrid as it sounds! So much fun to hack around with though.)
- lewis1028282 6y agoYou can just write char drivers that operate a slab of kernel memory, and implement all the syscalls like open, read, write on that piece of memory.
- Narishma 6y agoWhy would it be controversial?
- Frost1x 6y ago>Why would it be controversial? Not OP but my perspective is that much of software development, engineering, and practices become cult like, often without theoretical or empirical basis. I'm rarely surprised anymore when I see criticism of one approach over another. Someone may think "the way" to learn Linux kernel development isn't what OP suggested and there's a cult of people who agree who will adamantly concur to a fault.
- jabedude 6y agoHello, could you share the link for the updated version of LDD3?
- Ristovski 6y agoI was able to find this, which appears to have been updated for 4.x kernels, https://github.com/jgraha8/ldd3-examples-modern https://github.com/jgraha8/ldd3-examples-modern
- nullbuffer 6y agoAlternatively there's this: https://github.com/martinezjavier/ldd3 https://github.com/martinezjavier/ldd3
- vmladenov 6y agoThis doesn’t seem controversial. It’s how the operating systems class[1] was structured at University of Illinois, though the target was a VM instead of physical hardware. It was easier to reset things when your new scheduler module instantly crashes the OS. [1]https://courses.engr.illinois.edu/cs423/sp2016/ https://courses.engr.illinois.edu/cs423/sp2016/