Writing Linux Device Drivers
Standard Level - 5 daysview dates and locations
Linux is being used more and more on embedded systems driven by increasingly complex devices and a greater requirement for connectivity & multimedia applications. Developing custom device drivers for the Linux kernel can be a complex and difficult task, with an array of choices available on how best to implement what is required for your system.
Writing Linux Device Drivers is a 5 day course providing the practical skills and knowledge required to work with the Linux kernel in this environment.
The course provides a step by step approach on how to interact with complex hardware in the Linux kernel, building up from a simple "hello world" module through to managing much more advanced devices. Good practice when writing Linux drivers is explained in-depth, looking at issues to do with synchronisation, concurrency, power management and so on. Working with USB and network devices is also considered in detail.
Delegates will achieve the learning outcomes and gain the skills they need to develop and maintain custom Kernel device drivers for embedded Linux based products.
Workshops comprise approximately 50% of class time, and are based around carefully designed Labs to reinforce and challenge the extent of learning. The course uses a recent Linux kernel, as delivered on www.kernel.org.
This course is provided in partnership with embedded experts AC6.
What you will learn
- Mastering kernel development and debug tools
- Discovering multi-core programming in the Linux kernel
- Programming IOs, interrupts, timers and DMA
- Installing and integrating drivers inside the Linux kernel
- Managing synchronous and asynchronous IOs and ioctl
- Writing a complete character driver
- Mastering kernel debugging techniques with Lauterbach JTAG probes.
Who should attend?
- This course is designed for anyone wishing to get started quickly on developing custom kernel drivers for an embedded Linux system.
Pre-requisitesAttendance of Developing with Embedded Linux is strongly recommended and/or a good understanding of:
- Knowledge and practice of C programming
- Preferably knowledge of Linux user programming.
This is a hands-on training course and labs are conducted on a real target board:
- Quad Cortex/A9-based "Sabre" boards from NXP, with Lauterbach JTAG probes.
- Dual Cortex/A9-based "Panda ES" boards from Texas Instruments, with Lauterbach JTAG probes.
- Atmel ARM9-based boards, with Lauterbach JTAG probes.
A recent (3.x) Linux kernel is used as delivered on www.kernel.org.
Structure and Content
Linux kernel programming
- Development in the Linux kernel
- Memory allocation
- Linked lists
- Debug tools
Lab: Writing the "hello world" kernel module
Lab: Adding a driver to kernel sources and configuration menu
Lab: Using module parameters
Lab: Writing interdependent modules using memory allocations, reference counting and linked lists
- Task handling
- Concurrent programming
- Kernel threads
Lab: Fixing race conditions in the previous lab with mutexes
Introduction to Linux drivers
- Accessing the device driver from user space
- Driver registration
Lab: Step by step implementation of a character driver:
- driver registration (major/minor reservation) and device special file creation (/dev)
Driver I/O functions
- Kernel structures used by drivers
- Opening and closing devices
- Data transfers
- Controlling the device
- Mapping device memory
Lab: Step by step implementation of a character driver:
- Implementing open and release
- Implementing read and write
- Implementing ioctl
- Implementing mmap
Synchronous and asynchronous requests
- Task synchronization
- Synchronous request
- Asynchronous requests
Lab: Implementation of a pipe-like driver:
- implementing waiting and waking
- adding non-blocking, asynchronous and multiplexed operations
(O_NONBLOCK, SIGIO, poll/select)
Input/Output and interrupts
- Memory-mapped registers
Lab: Polling gpio driver with raw register access
Lab: Interrupt-based gpio driver with raw register access
Lab: gpio driver using the gpiolib
- Plug-and-Play management
- Static devices declaration
- in the BSP code
- in the device tree
- Platform bus
- Power management
- System sleep
- Implementing power management in drivers
- Remote wakeup
Lab: Implementing a platform driver and customizing the device tree to associate it to its device
(a serial port)
Lab: Implementing power management in the previous driver
Lab: Implementing remote wakeup in the previous driver
Linux Driver Model
- Linux Driver Model Architecture
- Hot plug management
- Plugging devices
- Removing devices
- Writing udev rules
Lab: Writing a custom class driver
Lab: Writing a misc driver
- Virtual Memory
- Memory Allocation
- Free page management
- Normal memory allocation
- Virtual memory allocation
- Huge allocations
- Direct Memory Access
- DMA scenarios
- Buffer access
- DMA programming
- Bus master DMA
- Slave DMA
- Memory barriers
Lab: Implementing slave DMA in a serial port driver
- The USB bus
- USB devices
- User-space USB interface
- USB descriptors
- USB requests
- USB device drivers
Lab: Writing a USB host driver
- network interface representation (struct net_device)
- network packet (struct sk_buff)
- receiving packets
- sending packets
- lost packets management
- network interface statistics
- New network API (NAPI)
- "interrupt mitigation" (suppression of unneeded IRQs)
- "packet throttling" (suppression of packets in the driver itself when system is overwhelmed)
Looking for team-based training, or other locations?
Complete an on-line form and a Doulos representative will get back to you »
Price on request
Back to top