Linux Device Drivers: Reading, Writing, and Debugging
2h 57mAdvanced2025-06-09
Authors

Kevin Dankwardt
Linux Leader, Embedded Linux Authority
Course details
One of the most important functions of any operating system is managing various types of hardware connected to the system, from simpler items like serial ports and keyboards to more complex hardware like USB cameras, hard drives, and networked devices. By understanding how Linux device drivers function, you can derive useful insights into the behavior of the Linux kernel and how users and developers can—and cannot—interact with devices. In this course, Kevin Dankwardt explains how loadable kernel modules work, then details three different types of Linux device drivers—character device drivers, block drivers, and network drivers—and the aspects and uses of each. Kevin covers the basics of each type of driver, and then guides you through writing, debugging, tracing, and adding functionality to the different device drivers.
Learning objectives
Describe and effectively use Linux device files.
Write a simple Linux device driver as a loadable kernel module.
Use several techniques for debugging Linux kernel level code including device drivers. Define and implement Linux character device drivers.
Describe Linux block and network device drivers.
Learning objectives
Describe and effectively use Linux device files.
Write a simple Linux device driver as a loadable kernel module.
Use several techniques for debugging Linux kernel level code including device drivers. Define and implement Linux character device drivers.
Describe Linux block and network device drivers.
Skills covered
Software AdministrationLinuxNetwork and System AdministrationOpen SourceOne-Off
Concepts
0. Introduction
- 01 - Explore Linux device drivers
- 02 - What you should know
1. Working with the Linux Kernel
- 03 - Getting Linux kernel source code
- 04 - Linux kernel documentation tree
- 05 - The kernel make system
- 06 - Linux kernel headers
- 07 - Challenge - Download and make a Linux kernel
- 08 - Solution - Download and make a Linux kernel
2. How Loadable Modules Work
- 09 - The benefits of loadable modules
- 10 - Introduction to module commands
- 11 - Depmod and modprobe
- 12 - Module parameters
- 13 - Module parameters in device driver code
- 14 - Work with licensing and modules
- 15 - Challenge - Work with loadable modules
- 16 - Solution - Work with loadable modules
3. Compiling and Debugging
- 17 - Writing a loadable kernel module
- 18 - Build and load a loadable module
- 19 - Use printk() and pr ()
- 20 - Tracing and debugging
- 21 - Challenge - Write, trace, debug
- 22 - Solution - Write, trace, debug
4. Character Device Drivers
- 23 - Use device files
- 24 - Create device files
- 25 - Character device driver file operations
- 26 - Implementing operation functions
- 27 - Write a character device driver
- 28 - The dev null driver
- 29 - Understand the user and kernel address spaces
- 30 - Challenge - Write a character driver
- 31 - Solution - Write a character driver
5. Block Drivers
- 32 - Use block device files
- 33 - Describe the function of the block layer
- 34 - Block driver operations
- 35 - Handle I O requests
- 36 - Challenge - Investigate block layer and devices
- 37 - Solution - Investigate block layer and devices
6. Network Drivers
- 38 - Look at the role of network device drivers
- 39 - Network driver interrupt handling
- 40 - Examine the net device ops structure
- 41 - Examine PCI-related APIs in network drivers
- 42 - Challenge - Using tools with a network driver
- 43 - Solution - Using tools with a network driver
7. User Space Device Drivers
- 44 - Introduction to user space device drivers
- 45 - UIO, mapping device memory, and interrupts
- 46 - Kernel modules for user space drivers
- 47 - User space Ethernet driver
- 48 - I2C from user space
- 49 - Challenge - Modify and test a user space driver
- 50 - Solution - Modify and test a user space driver
Conclusion
- 51 - Next steps