This instructor-led course is designed to show experienced programmers how to develop device drivers for embedded Linux systems, and give them a basic understanding and familiarity with the Linux kernel. Hands-on labs with a RISC-V based emulated development target allow students to practice what is learned in class.
Developing Embedded Linux Device Drivers (LFD435)
- Who You Are
- The Linux Foundation
- Copyright and No Confidential Information
- Linux Foundation Training
- Certification Programs and Digital Badging
- Linux Distributions
- Preparing Your System
- Things change in Linux
- Documentation and Links
- Kernel Versions
- Kernel Sources and Use of git
- Hardware
- Staging Tree
- Labs
- Know Where the Code is Coming From: DCO and CLA
- 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
- Built-in Linux Distribution Cross Compiler
- Linaro
- CodeSourcery
- crosstool-ng
- Buildroot
- OpenEmbedded
- Yocto Project
- Labs
- Why use QEMU?
- Emulated Architectures
- Image Formats
- Labs
- Getting SW onto a uSD card
- Booting from flash
- Why is using uSD cards a bad idea?
- Labs
- An easier way to develop
- The Boot Sequence using TFTP and NFSroot
- Objectives of the Lab
- Labs
- Labs
- 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
- Modules and Hot Plug
- Labs
- Memory Zones
- Page Tables
- kmalloc()
- get free pages()
- vmalloc()
- Slabs and Cache Allocations
- Labs
- 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
- User-Space vs. Kernel-Space
- What are System Calls?
- Available System Calls
- Scheduling Algorithms and Task Structures
- Process Context
- Labs
- 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
- Main Data Structures
- Registering Platform Devices
- An Example
- Hardcoded Platform Data
- The New Way: Device Trees
- Labs
- 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
- Exceptions
- Asynchronous Interrupts
- MSI
- Enabling/Disabling Interrupts
- What You Cannot Do at Interrupt Time
- IRQ Data Structures
- Installing an Interrupt Handler
- Labs
- Jiffies
- Getting the Current Time
- Clock Sources
- Real Time Clock
- Programmable Interval Timer
- Time Stamp Counter
- HPET
- Going Tickless
- What are Kernel Timers?
- Low Resolution Timer Functions
- Low Resolution Timer Implementation
- High Resolution Timers
- Using High Resolution Timers
- Labs
- Driver Entry point for ioctls
- Defining ioctls
- Labs
- Basic Structures
- Real Devices
- sysfs
- kset and kobject examples
- Labs
- Loading Firmware
- Labs
- Going to Sleep and Waking Up
- Going to Sleep Details
- Exclusive Sleeping
- Waking Up Details
- Polling
- Labs
- Softirqs
- Tasklets
- Work Queues
- New Work Queue API
- Creating Kernel Threads
- Threaded Interrupt Handlers
- Interrupt Handling in User-Space
- Labs
- Allocating and Mapping I/O Memory
- Accessing I/O Memory
- DMA Directly to User
- DMA and Interrupts
- DMA Memory Constraints
- DMA Masks
- DMA API
- DMA Pools
- Scatter/Gather Mappings
- Labs
- NAND vs. NOR vs. eMMC
- Driver and User Modules
- Flash Filesystems
- USB Topology
- Terminology
- Endpoints
- Descriptors
- USB Device Classes
- USB Support in Linux
- Registering USB Device Drivers
- Moving Data
- Example of a USB Driver
- Labs
- Monolithic and Micro Kernels
- Object-Oriented Methods
- Main Kernel Components
- User-Space and Kernel-Space
- Memory Allocation
- Transferring Data between User and Kernel Spaces
- Object-Oriented Inheritance - Sort Of
- Linked Lists
- Jiffies
- Labs
- A Trivial Example
- Compiling Modules
- Modules vs Built-in
- Module Utilities
- Automatic Module Loading
- Module Usage Count
- Module Licensing
- Exporting Symbols
- Resolving Symbols **
- Labs
- Kernel Preemption
- Real Time Preemption Patch
- Labs
- Kernel Browsers
- Kernel Configuration Files
- Kernel Building and Makefiles
- initrd and initramfs
- Labs
- 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
- Atomic Operations
- Bit Operations
- Spinlocks
- Seqlocks
- Disabling Preemption
- Mutexes
- Semaphores
- Completion Functions
- Read-Copy-Update (RCU)
- Reference Counts
- Labs
- 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
- Buddy System
- Slabs and Cache Allocations
- Memory Pools
- kmalloc()
- vmalloc()
- Early Allocations and bootmem()
- Memory Defragmentation
- Labs
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.