Build a Linux Driver from Zero: USB & NIC
Build a driver from zero in three stages, finishing with a working USB network card.
Beginner30 lessons
written lessons≈ 15 h
Linux Kernel & Device Drivers, High-Performance Networking & Cloud-Native · 30 illustrated lessons (text/HTML)
Outcomes
- Go from kernel module basics to a complete device driver
- Implement a NIC driver: init, NAPI receive, transmit and ethtool
- Combine USB and network frameworks in a capstone driver
Where we teach this
The lessons
Every lesson in this curriculum, in the order we teach it.
- 1Introduction: getting started with Linux device drivers
- 2Kernel module basics
- 3The character-device driver framework
- 4User-space and kernel-space interaction
- 5Concurrency and synchronisation: spinlocks, semaphores, mutexes and completions in drivers
- 6Memory management: kmalloc/kfree, vmalloc/vfree, get_free_pages and DMA memory
- 7Interrupt handling
- 8Time and delays: jiffies, timers and kernel delay functions
- 9The platform device driver model
- 10USB subsystem architecture overview
- 11Core USB driver data structures
- 12Writing your first USB driver
- 13Programming USB data transfers
- 14USB HID driver example: parsing report descriptors and reporting input events
- 15USB storage driver walkthrough: the SCSI translation layer and the usb-storage driver
- 16The network device driver framework
- 17Packet processing
- 18NAPI: old and new receive-path approaches compared
- 19NIC driver initialisation and registration
- 20NIC interrupt handling and data reception
- 21NIC packet transmission: the transmit function and transmit-completion interrupts
- 22NIC statistics and status: implementing ethtool operations and maintaining counters
- 23Virtual network device driver example: writing a simple dummy network interface
- 24Real NIC driver analysis (using the Intel e1000)
- 25The PCI/PCIe bus and drivers
- 26USB network card case study, part 1: recognised as a USB and network device
- 27USB network card case study, part 2: sending and receiving network data over USB bulk transfers
- 28USB network card case study, part 3: completing the driver with the network device framework
- 29Driver debugging techniques
- 30Course summary and next steps
All-access library
Every curriculum on this page, with the labs and lab sequences, for a year.