7 ms·
Replying after checking my notes from the University (NTUA): Before around 14 years (~ 2004) one of the excersies we had in Operatin Systems Lab was to actually
by spapas82 9y ago
Replying after checking my notes from the University (NTUA): Before around 14 years (~ 2004) one of the excersies we had in Operatin Systems Lab was to actually implement a char device driver for Linux called ... lunix as a kernel module. The actual device was just a buch of bytes in memory.
These times were so happy - implementing a device driver seemed like owning the world for a student!
If anybody wants I'd be happy to put the source code in github - mainly for historical reasons because I'm not sure that the code will be still working today.
- magpi3 9y agoThere is a similar exercise in "Linux Device Drivers." The first driver they ask you to write is a char device that runs in memory called "scull." Here is a link to the free book (warning it's a pdf): http://free-electrons.com/doc/books/ldd3.pdf http://free-electrons.com/doc/books/ldd3.pdf And here is a link to a github project with all exercises updated for the most recent kernel: https://github.com/martinezjavier/ldd3 https://github.com/martinezjavier/ldd3
- spapas82 9y agoHa ha "scull" ringed a bell and after taking a look at the cover of the book you mention (it's not in the pdf you provide but can be found if you search for images for Linux Device Drivers oreilly) and see the horse ... I totally remembered the book! It was one of the refereces I used while implementing the module and it was a really good and comprehensive book - totally agree with the recommendation :)
- abstractbeliefs 9y agoPlease do. One of the issues for tfa is how little it actually covers. While it quite fairly says module development is more like writing an API than an application, it then proceeds to entirely ignore any hooks other than init and exit!
- spapas82 9y agoI'll try adding it tomorrow to github (it's a little late here right now). In the meantime, I'd like to also recommend the book "Linux Device Drivers" that fellow commenter magpi3 mentioned.
- spapas82 9y agoHere you go: https://github.com/spapas/lunix https://github.com/spapas/lunix Notice - I tried compiling it but was not able to (and I don't have time to research modernizing this code).