Course Overview
Upon mastering this material, students will be familiar with the different kinds of device drivers used under Linux and have an introduction to many of the appropriate APIs to be used when writing a device driver. The labs for illustrating these concepts will all be performed on ARM hardware in order to get developers familiar with cross-compiling and developing drivers for an embedded target. This course will prepare you to develop device drivers for embedded Linux systems.
What you’ll learn
This course is for experienced developers who need to develop device drivers for embedded Linux systems.
Requirements
- To make the most of this course, you must have: Knowledge of basic kernel interfaces and methods such as how to write, compile, load and unload modules, use synchronization primitives, and the basics of memory allocation and management, such as is provided by LFD420 (Kernel Internals and Development). Pre-class preparation material will be provided before class.
Target audiences
- This course is for experienced developers who need to develop device drivers for embedded Linux systems.
Curriculum
- 1 Section
- 39 Lessons
- 4 Days
Expand all sectionsCollapse all sections
- Topics39
- 1.1Introduction Objectives Who You Are The Linux Foundation Linux Foundation Training Certification Programs and Digital Badging Linux Distributions Preparing Your System Things change in Linux Documentation and Links
- 1.2Preliminaries Procedures Kernel Versions Kernel Sources and Use of git Hardware
- 1.3How to Work in OSS Projects ** Overview on How to Contribute Properly Stay Close to Mainline for Security and Quality Study and Understand the Project DNA Figure Out What Itch You Want to Scratch Identify Maintainers and Their Work Flows and Methods Get Early Input and Work in the Open Contribute Incremental Bits, Not Large Code Dumps Leave Your Ego at the Door: Don’t Be Thin-Skinned Be Patient, Develop Long Term Relationships, Be Helpful
- 1.4Cross-Development Toolchain The Compiler Triplet Built-in Linux Distribution Cross Compiler Linaro CodeSourcery crosstool-ng Buildroot OpenEmbedded Yocto Project Labs
- 1.5QEMU What is QEMU? Emulated Architectures Image Formats Why use QEMU? Labs
- 1.6Booting a Target Development Board from uSD Why do we use uSD cards? Getting SW onto a uSD card Why is using uSD cards a bad idea? Labs
- 1.7Booting a Target Development Board over Ethernet Using virtual Hardware An easier way to develop Objectives of the Lab Labs
- 1.8Kernel Configuration, Compilation, Booting Configuring the Kernel for the Development Board Labs
- 1.9Device Drivers Types of Devices Mechanism vs. Policy Avoiding Binary Blobs Power Management How Applications Use Device Drivers Walking Through a System Call Accessing a Device Error Numbers printk() devres: Managed Device Resources Labs
- 1.10Modules and Device Drivers The module_driver() Macros Modules and Hot Plug Labs
- 1.11Memory Management and Allocation Virtual and Physical Memory Memory Zones Page Tables kmalloc() __get_free_pages() vmalloc() Slabs and Cache Allocations Labs
- 1.12Character Devices Device Nodes Major and Minor Numbers Reserving Major/Minor Numbers Accessing the Device Node Registering the Device udev dev_printk() and Associates file_operations Structure Driver Entry Points The file and inode Structures Miscellaneous Character Drivers Labs
- 1.13Kernel Features Components of the Kernel User-Space vs. Kernel-Space What are System Calls? Available System Calls Scheduling Algorithms and Task Structures Process Context Labs
- 1.14Transferring Between User and Kernel Space Transferring Between Spaces put(get)_user() and copy_to(from)_user() Direct Transfer: Kernel I/O and Memory Mapping Kernel I/O Mapping User Pages Memory Mapping User-Space Functions for mmap() Driver Entry Point for mmap() Accessing Files from the Kernel Labs
- 1.15Platform Drivers What are Platform Drivers? Main Data Structures Registering Platform Devices An Example Hardcoded Platform Data The New Way: Device Trees Labs
- 1.16Device Trees What are Device Trees? What Device Trees Do and What They Do Not Do Device Tree Syntax Device Tree Walk Through Device Tree Bindings Device Tree support in Boot Loaders Using Device Tree Data in Drivers Coexistence and Conversion of Old Drivers Labs
- 1.17Interrupts and Exceptions What are Interrupts and Exceptions? Exceptions Asynchronous Interrupts MSI Enabling/Disabling Interrupts What You Cannot Do at Interrupt Time IRQ Data Structures Installing an Interrupt Handler Labs
- 1.18Timing Measurements Kinds of Timing Measurements Jiffies Getting the Current Time Clock Sources Real Time Clock Programmable Interval Timer Time Stamp Counter HPET Going Tickless
- 1.19Kernel Timers Inserting Delays What are Kernel Timers? Low Resolution Timer Functions Low Resolution Timer Implementation High Resolution Timers Using High Resolution Timers Labs
- 1.20ioctls What are ioctls? Driver Entry point for ioctls Defining ioctls Labs
- 1.21Unified Device Model and sysfs Unified Device Model Basic Structures Real Devices sysfs kset and kobject examples Labs
- 1.22Firmware What is Firmware? Loading Firmware Labs
- 1.23Sleeping and Wait Queues What are Wait Queues? Going to Sleep and Waking Up Going to Sleep Details Exclusive Sleeping Waking Up Details Polling Labs
- 1.24Interrupt Handling: Deferrable Functions and User Drivers Top and Bottom Halves Softirqs Tasklets Work Queues New Work Queue API Creating Kernel Threads Threaded Interrupt Handlers Interrupt Handling in User-Space Labs
- 1.25Hardware I/O Memory Barriers Allocating and Mapping I/O Memory Accessing I/O Memory
- 1.26Direct Memory Access (DMA)** What is DMA? DMA Directly to User DMA and Interrupts DMA Memory Constraints DMA Masks DMA API DMA Pools Scatter/Gather Mappings Labs
- 1.27Memory Technology Devices (Flash Memory Filesystems) What are MTD Devices? NAND vs. NOR vs. eMMC Driver and User Modules Flash Filesystems
- 1.28USB Drivers What is USB? USB Topology Terminology Endpoints Descriptors USB Device Classes USB Support in Linux Registering USB Device Drivers Moving Data Example of a USB Driver Labs
- 1.29Closing and Evaluation Survey Evaluation Survey
- 1.30Appendices — Booting the Target Development Board from uSD Objectives of the Lab Labs
- 1.31Kernel Architecture I UNIX and Linux ** Monolithic and Micro Kernels Object-Oriented Methods Main Kernel Tasks User-Space and Kernel-Space
- 1.32Kernel Programming Preview Task Structure Memory Allocation Transferring Data between User and Kernel Spaces Linked Lists Jiffies Labs
- 1.33Modules What are Modules? A Trivial Example Compiling Modules Modules vs Built-in Module Utilities Automatic Loading/Unloading of Modules Module Usage Count Module Licensing Exporting Symbols Resolving Symbols ** Labs
- 1.34Kernel Architecture II Processes, Threads, and Tasks Kernel Preemption Real Time Preemption Patch Labs
- 1.35Kernel Configuration and Compilation Installation and Layout of the Kernel Source Kernel Browsers Kernel Configuration Files Kernel Building and Makefiles initrd and initramfs Labs
- 1.36Kernel Style and General Considerations Coding Style Using Generic Kernel Routines and Methods Making a Kernel Patch sparse Using likely() and unlikely() Writing Portable Code, CPU, 32/64-bit, Endianness Writing for SMP Writing for High Memory Systems Power Management Keeping Security in Mind Labs
- 1.37Race Conditions and Synchronization Methods Concurrency and Synchronization Methods Atomic Operations Bit Operations Spinlocks Seqlocks Disabling Preemption Mutexes Semaphores Completion Functions Read-Copy-Update (RCU) Reference Counts Labs
- 1.38Memory Addressing Virtual Memory Management Systems With and Without MMU and the TLB Memory Addresses High and Low Memory Memory Zones Special Device Nodes NUMA Paging Page Tables page structure Labs
- 1.39Memory Allocation Requesting and Releasing Pages Buddy System Slabs and Cache Allocations Memory Pools kmalloc() vmalloc() Early Allocations and bootmem() Memory Defragmentation Labs
