DRV-101 · Device Drivers · Foundation
Character Devices & sysfs — full syllabus
Your first working driver: character device registration, file operations, and exposing state through sysfs.
Who this course is for
Engineers writing their first Linux driver — firmware or userspace developers who need a working mental model of how a device file actually reaches their code.
Prerequisites
- C programming, including pointers and structures
- Basic Linux command line and file I/O from userspace
- Having compiled and loaded a kernel module once is helpful but not required
Course outline
Day 1 — Registering a character device
- Major/minor numbers and what they actually identify
- alloc_chrdev_region vs static majors
- cdev_init, cdev_add and the registration order
- device_create, udev and how /dev nodes appear
- module_init/module_exit vs the probe model you will meet later
Day 2 — file_operations and the user boundary
- The file_operations table: open, read, write, release, llseek
- copy_to_user/copy_from_user and the page-fault path underneath
- access_ok and why the check is not the copy
- ioctl: command number encoding with _IO/_IOR/_IOW/_IOWR
- Per-device state vs per-open state and the locking each needs
Day 3 — Exposing driver state
- kobjects as the base object and their lifetime rules
- sysfs attributes with DEVICE_ATTR: one value per file, no exceptions
- Attribute groups and binary attributes
- procfs: what it is for and what it is not for
- debugfs for driver introspection without ABI promises
Hands-on labs
- Lab: Register a char device with alloc_chrdev_region and cdev_add; watch udev create the node and verify reads reach your handler
- Lab: Implement read/write across the user boundary, then pass a bad pointer deliberately and decode the resulting fault
- Lab: Add an ioctl interface with correctly encoded command numbers and drive it from a small C test program
- Lab: Expose counters and state through sysfs attributes and a debugfs dump file; script a reader for both
- Lab: Race two processes against your device, reproduce the corruption, and fix it with the right lock — verified with lockdep
Capstone project
Build a small but complete character driver: a kernel ring-buffer device with read/write, an ioctl control surface, a sysfs status attribute and a debugfs dump — delivered with a userspace test program and a fault-injection checklist demonstrating that every error path (bad pointers, failed allocations, double unload) unwinds cleanly.
What you leave with
- A working character driver you wrote and can explain line by line
- Correct copy_to_user/copy_from_user and ioctl patterns
- sysfs/debugfs exposure habits that will pass review
- Error-unwinding discipline: every allocation paired with a cleanup path
- A userspace test harness template reusable for future drivers
Upcoming dates
| Dates | Where | Seats | Early bird | Regular | |
|---|---|---|---|---|---|
| 15 Nov – 17 Nov 20263 full days | RiyadhIn person · KAFD Conference Centre | 6 of 14 | SAR 6,080until 16 Oct | ||
| 15 Nov – 17 Nov 20263 full days | Kuwait CityIn person · Al Hamra Tower | 11 of 14 | KWD 500until 16 Oct | ||
| 22 Nov – 24 Nov 20263 full days | MuscatIn person · Knowledge Oasis Muscat | 6 of 14 | OMR 620until 23 Oct | ||
| 29 Nov – 6 Dec 20266 half-days | Gulf bandLive online · 09:00–13:00 GMT+3 | 16 of 20 | US$1,170until 30 Oct | ||
| 30 Nov – 2 Dec 20263 full days | OttawaIn person · Kanata North Tech Park | 11 of 14 | CAD 2,200until 31 Oct | ||
| 30 Nov – 2 Dec 20263 full days | TorontoIn person · MaRS Discovery District | 6 of 14 | CAD 2,200until 31 Oct | ||
| 30 Nov – 7 Dec 20266 half-days | Europe bandLive online · 09:00–13:00 CET | 5 of 20 | US$1,170until 31 Oct | ||
| 7 Dec – 9 Dec 20263 full days | LondonIn person · Shoreditch Works | 11 of 14 | GBP 1,260until 7 Nov | ||
| 7 Dec – 14 Dec 20266 half-days | Americas bandLive online · 13:00–17:00 ET | 10 of 20 | US$1,170until 7 Nov | ||
| 14 Dec – 16 Dec 20263 full days | BerlinIn person · Factory Görlitzer Park | 6 of 14 | EUR 1,490until 14 Nov |
Book a seat, or bring this course to your team
Seats can be reserved online; private delivery runs on-site or live online, adapted to your stack.
Questions about fit or prerequisites? Email hello@kernelsystems.academy. To save this syllabus, print this page to PDF from your browser.