Training > IoT & Embedded Development > Developing Embedded Linux Device Drivers (LFD435)

Developing Embedded Linux Device Drivers (LFD435)

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.

Who Is It For

This course is for experienced developers who need to develop device drivers for embedded Linux systems.
read less read more
What You’ll Learn

Upon mastering this material, you 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.
read less read more
What It Prepares You For

This course will prepare you to develop device drivers for embedded Linux systems.
read less read more
Course Outline
Expand All
Collapse All
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
Kernel Versions
Kernel Sources and Use of git
How 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
Cross-Development Toolchain
The Compiler Triplet
Built-in Linux Distribution Cross Compiler
Yocto Project
What is QEMU?
Emulated Architectures
Image Formats
Why use QEMU?
Booting 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?
Booting a Target Development Board over Ethernet
Using virtual Hardware
An easier way to develop
Objectives of the Lab
Kernel Configuration, Compilation, Booting
Configuring the Kernel for the Development Board
Device 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
devres: Managed Device Resources
Modules and Device Drivers
The module_driver() Macros
Modules and Hot Plug
Memory Management and Allocation
Virtual and Physical Memory
Memory Zones
Page Tables
Slabs and Cache Allocations
Character Devices
Device Nodes
Major and Minor Numbers
Reserving Major/Minor Numbers
Accessing the Device Node
Registering the Device
dev_printk() and Associates
file_operations Structure
Driver Entry Points
The file and inode Structures
Miscellaneous Character Drivers
Kernel Features
Components of the Kernel
User-Space vs. Kernel-Space
What are System Calls?
Available System Calls
Scheduling Algorithms and Task Structures
Process Context
Transferring 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
Platform Drivers
What are Platform Drivers?
Main Data Structures
Registering Platform Devices
An Example
Hardcoded Platform Data
The New Way: Device Trees
Device 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
Interrupts and Exceptions
What are Interrupts and Exceptions?
Asynchronous Interrupts
Enabling/Disabling Interrupts
What You Cannot Do at Interrupt Time
IRQ Data Structures
Installing an Interrupt Handler
Timing Measurements
Kinds of Timing Measurements
Getting the Current Time
Clock Sources
Real Time Clock
Programmable Interval Timer
Time Stamp Counter
Going Tickless
Kernel Timers
Inserting Delays
What are Kernel Timers?
Low Resolution Timer Functions
Low Resolution Timer Implementation
High Resolution Timers
Using High Resolution Timers
What are ioctls?
Driver Entry point for ioctls
Defining ioctls
Unified Device Model and sysfs
Unified Device Model
Basic Structures
Real Devices
kset and kobject examples
What is Firmware?
Loading Firmware
Sleeping and Wait Queues
What are Wait Queues?
Going to Sleep and Waking Up
Going to Sleep Details
Exclusive Sleeping
Waking Up Details
Interrupt Handling: Deferrable Functions and User Drivers
Top and Bottom Halves
Work Queues
New Work Queue API
Creating Kernel Threads
Threaded Interrupt Handlers
Interrupt Handling in User-Space
Hardware I/O
Memory Barriers
Allocating and Mapping I/O Memory
Accessing I/O Memory
Direct Memory Access (DMA)**
What is DMA?
DMA Directly to User
DMA and Interrupts
DMA Memory Constraints
DMA Masks
DMA Pools
Scatter/Gather Mappings
Memory Technology Devices (Flash Memory Filesystems)
What are MTD Devices?
NAND vs. NOR vs. eMMC
Driver and User Modules
Flash Filesystems
USB Drivers
What is USB?
USB Topology
USB Device Classes
USB Support in Linux
Registering USB Device Drivers
Moving Data
Example of a USB Driver
Closing and Evaluation Survey
Evaluation Survey
Booting the Target Development Board from uSD
Objectives of the Lab
Kernel Architecture I
UNIX and Linux **
Monolithic and Micro Kernels
Object-Oriented Methods
Main Kernel Tasks
User-Space and Kernel-Space
Kernel Programming Preview
Task Structure
Memory Allocation
Transferring Data between User and Kernel Spaces
Linked Lists
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 **
Kernel Architecture II
Processes, Threads, and Tasks
Kernel Preemption
Real Time Preemption Patch
Kernel Configuration and Compilation
Installation and Layout of the Kernel Source
Kernel Browsers
Kernel Configuration Files
Kernel Building and Makefiles
initrd and initramfs
Kernel Style and General Considerations
Coding Style
Using Generic Kernel Routines and Methods
Making a Kernel Patch
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
Race Conditions and Synchronization Methods
Concurrency and Synchronization Methods
Atomic Operations
Bit Operations
Disabling Preemption
Completion Functions
Read-Copy-Update (RCU)
Reference Counts
Memory Addressing
Virtual Memory Management
Systems With and Without MMU and the TLB
Memory Addresses
High and Low Memory
Memory Zones
Special Device Nodes
Page Tables
page structure
Memory Allocation
Requesting and Releasing Pages
Buddy System
Slabs and Cache Allocations
Memory Pools
Early Allocations and bootmem()
Memory Defragmentation

** These sections may be considered in part or in whole as optional. They contain either background reference material, specialized topics, or advanced subjects. The instructor may choose to cover or not cover them depending on classroom experience and time constraints.
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.

Jan 2022
I enjoyed learning from an industry expert. The nice book, friendly classmates, and the classroom environment was very nice.
Jan 2022
Trainer's expertise. He was stressing more the importance of topics like device trees.
Jan 2022
Instructor was extremely knowledgeable, friendly, patient, and conveyed information extremely well. Course gave me a great baseline knowledge to work with; I will need to practice on my own time to fully cement the lessons into my head.
Nov 2021
Good coverage of all sorts of drivers and internals.
Nov 2021
I appreciated Tom's explanation of things. It is one thing to read about a topic, but it definitely adds value to have somebody there with experience who can help explain it, and point out things that are important, and things that maybe aren't as much.
Nov 2021
The instructor was very engaging, and quite helpful during problematic labs. He added to the material from his own experiences, which I personally value highly, as it speaks to things that are real, vs examples that are contrived for the purpose of an exercise.
Nov 2021
The way the lab Resources and Solutions (Lab) was implemented. Much of the time that gets wasted in setting up the environment and writing make files was saved, and we could focus on learning and developing drivers.
Nov 2021
Great class!
Nov 2021
Trainer's knowledge and style of communication.
Nov 2021
Observing the instructor using the tools.
Nov 2021
Practicing and the structure of the material, and of course Behan is a great instructor.
Nov 2021
The details and expertise of the instructor.
Apr 2021
The instructor is obviously a professional, and he knew how to answer all our questions perfectly. Moreover, the qemu emulations were great, it helped us a lot.
Apr 2021
The instructor was excellent! The labs are also very good, and the course book is well written as well.
Mar 2021
Instructor was great; went above and beyond by showing us examples in Linux that were not in the material.
Mar 2021
Good amount of depth; nice to break up the lecture with so many labs.