Writing device drivers in Linux
FreeA brief tutorial on writing device drivers in Linux
FreeFree tier
About Writing device drivers in Linux
A tutorial from Free Software Magazine that teaches how to write Linux device drivers, focusing on char devices loaded as modules for kernel 2.6.x. It covers prerequisites (C programming, microprocessor knowledge), the distinction between user space and kernel space, interfacing functions between user and kernel space and between kernel and hardware, and provides a step-by-step example of creating a minimal module ('nothing.c') for loading and removing. Written by Xavier Calbet, the tutorial assumes familiarity with assembler programming and aims to equip readers with the foundational skills to develop device drivers.
Key Features
Covers prerequisites: C programming and microprocessor knowledge
Explains user space vs kernel space distinction
Describes interfacing functions between user space, kernel space, and hardware
Provides first driver example: loading and removing a module (nothing.c)
Focused on char devices and kernel 2.6.x modules
Pros & Cons
Pros
- Free and publicly accessible tutorial
- Step-by-step approach with a working minimal example
- Explains fundamental concepts like user/kernel space clearly
Cons
- Targets older kernel 2.6.x, so some details may be outdated for modern kernels
- Only covers char devices; no network or block drivers
- Assumes prior knowledge of C and low-level programming
Best For
Learning to develop Linux device drivers from scratchUnderstanding kernel module basics for char devicesGaining practical experience with module loading/unloading
FAQ
What prerequisites are needed to follow this tutorial?
You need in-depth knowledge of C programming (pointer usage, bit manipulation) and microprocessor programming (memory addressing, interrupts). Assembler programming familiarity is recommended.
What is the difference between user space and kernel space?
Kernel space is where the Linux kernel and its device drivers run, directly managing hardware. User space is where end-user applications run; they interact with hardware indirectly through kernel functions.