- Home
- Training
- Course List
- Graduate Training
- Mentoring
- Company Profile
- Our Blog
- Resources
- News
- Contact Us
Developing Linux Device Drivers
Implementing Linux on custom hardware will, in most cases, require you to write device drivers. This course demonstrates how to write code that runs within the Linux kernel to handle hardware events and present a standard interface to applications.
This course presents a detailed view of Linux device drivers with an emphasis on topics specific to embedded environments: cross compilation; remote debugging and real-time. It uses a combination of theory and practice, using a development board with an ARM core. No prior knowledge of Linux device drivers is assumed, making it ideal for engineers porting from code from an RTOS to Linux.
Dates:
6 -
10 Feb 2012
23 -
27 Apr 2012
23 -
27 Jul 2012
Course Outline
Writing Kernel Modules:
- Structure of a kernel module
- Compiling and loading modules
Introduction to Character Device Drivers:
- Major and minor numbers
- Basic operations ā open, read, write and release
- Example driver based on a fifo
Debugging Kernel Code and Device Drivers:
- Kernel oops messages
- Debugging with gdb and kgdb
The Linux Driver Model:
- Sysfs and the /sys directory
- Adding device classes and class attributes
Task Synchronisation:
- Putting tasks to sleep using wait queues
- Re-entrancy issues
- Mutexes, semaphores and spinlocks
Real Time Linux:
- How real-time is Linux?
- Things that affect real-time behaviour
- Kernel pre-emption modes
Input and Output:
- Interfacing with the real world
- Accessing memory and i/o mapped resources
Time:
- Delays and sleeps
- Using kernel timers.
Interrupts:
- Installing an interrupt handler; interrupt context and process context
- Deferred processing using a bottom half or tasklet.
Memory management:
- Allocating memory by pages and bytes
- Slab caches
- Techniques to map device memory directly into user space using mmap
- Getting direct access to user buffers
Block Device Drivers:
- Anatomy of a block device: example RAM disk driver
Devices on a PCI Bus:
- How to access PCI hardware
- An outline PCI driver
Network Device Drivers:
- Anatomy of a network device: example loop-back interface
Board Support Packages:
- Customising the Linux configuration menus
Course Overview
Course Objectives:
- Demonstrate how to write drivers for custom hardware
- Provide insight into porting drivers from an RTOS to Linux, e.g. the separation between application and kernel code
- Describe the development tools needed, including debug strategies
- Examine the way drivers can affect real-time behaviour and best practice to avoid scheduling latencies
Delegates Will Learn:
- How to write kernel modules
- How to create robust drivers using mutexes and spinlocks to serialise access to shared data
- How to debug kernel code running on a remote embedded target
- How to handle interrupts, including deferred processing using tasklets and work queues
- How to access hardware resources, including devices connected via PCI
- The details of memory management and memory mapping techniques
Pre-requisites:
- Good āCā programming skills
- General knowledge of an RTOS or embedded operating systems
- Knowledge of Linux or Unix is useful, but not essential
Who Should Attend:
Software engineers who are developing applications for embedded or real-time Linux. Engineers wishing to assess the suitability of Linux for their next application.
Duration:
- Five days
Course Material:
- Student workbook
Related Courses:
Laboratory Exercises:
During the lab sessions, students will write several fully-function device drivers, including a fifo, a RAM disk and a loop-back network interface. All exercises are developed and cross-compiled on a PC running Linux and downloaded to an ARM9 development board as the target (the Digi ConnectCore Wi-9C), emphasising the issues encountered when writing for embedded platforms.

