I recently pushed my first contribution to the official Nuttx repository on Bitbucket! Nuttx is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint.
I’m working at Robodev GmbH since June – a small Start Up getting ready to launch its new product series. In the last weeks I learned so much there and as Robodev uses Nuttx for its embedded devices I can also contribute to an open source community.
Check out my work: Driver for LTC 4151 – Example App
If you got to write a driver for the Linux kernel, you basically have two options: Either you compile it directly into the kernel or you use loadable kernel modules (LKM). The latter option has the advantage, as you might already have suggested, to load the driver dynamically during run time. I will focus in this post on some of the things one has to remember when creating a LKM. For a complete description please refer to Derek Molloy’s guide about LKM which has helped me a lot in understanding its concepts and implementation. All his code is also on GitHub.
The following code snippets can be useful in a LKM and give something like a starting point or show you what to remember; I tried to split them into topics so that individual information can be found without searching through a large piece of code.
Continue reading “Loadable Kernel Modules”