
Developing Linux Device Drivers
5 days
Télécharger le descriptif au format pdf
This course is delivered in co-operation with Doulos' training partner
Feabhas , who specialise in training courses for real-time embedded developers.
Course description
Implementing Linux on custom hardware will, in most cases, require you to write device drivers. This course shows how to write code that runs within the Linux kernel
to handle hardware events and present a standard interface to applications.
The 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 an development board with an ARM core and a recent version of Linux 2.6. No prior knowledge
of Linux device drivers is assumed, making it ideal for engineers porting from code from an RTOS to Linux.
Course Objectives
After completing the course attendees will:
• To show how to write drivers for custom hardware
• To give some insight into porting drivers from an RTOS to Linux, e.g. the separation between application and kernel code
• To describe the development tools needed, including debug strategies
• To 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 will be 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.
Materials
• Student workbook
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.
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 contexts
• 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
A• natomy of a network device: example loop-back interface
Board Support Packages
• Customising the Linux configuration menus
Top of Page