Estimated Time to Complete
Only available after login
What You'll Learn
Concepts:
Where Rust Kernel Code Lands Before Mainline
Booting a Rust-Enabled Kernel and Loading the Minimal Module
Reaching the Same Driver Body Through the Platform Bus
Interrupt Service Routine
Device Registers as a Chip's Control Panel
Closures
Building a Character Device You Can Read and Write from a Shell
Copying Data Between User and Kernel Memory Safely
Constants and Static Items in Rust
Installing the Rust Toolchain the Kernel Requires
Variables, Mutability, and Basic Types in Rust
Module Signing and Kernel Taint
Direct Memory Access and Cache Coherency
Port Input and Output Compared With Memory Mapping
Compiling the Kernel and Rebuilding Quickly
Raw Pointers and Dereferencing Them
Formatting Rust Kernel Code with rustfmt
Version Control Systems and Repository Management with Git
Lifetime Elision Rules
Splitting an Interrupt into Two Halves
Access That Can Be Taken Away
Kernel Coding Style and the checkpatch Script
Checking Rust Support with the rustavailable Target
PCI Vendor and Device Identifiers
Catching Mistakes at Build Time
Reference Counting
The Option Type
The Everything Is a File Device Model
What a PCI Base Address Register Is
The Borrow Checker
Closures and Variable Capture
C Strings in Kernel Rust
Counters That Need No Lock
Why Register Accesses Must Not Be Reordered or Cached
Defining Control Commands for a Device File
How Device Files Appear Under the dev Directory
Marking Unused Type Parameters with PhantomData
Predict a Sample Driver's Log Before You Run It
Using a SpinLock Where Sleeping Is Forbidden
The Copy Trait
Concurrency
Mapping a Card's Register Window
Character Devices and Major and Minor Numbers
The Deref Trait
Memory-Mapped Input and Output: A Device Register Is an Address
Wrapping a C Structure with Opaque
Building the Kernel with Clang and LLVM
Claiming a PCI Device from Rust
Attributes and Derive in Rust
Turning On Rust Support and the Rust Samples
Implementing a Trait for Your Own Type
Interior Mutability
Traits in Rust
Registering Your Driver with a Bus
Where to Ask Questions About Kernel Rust
Bus Mastering: Letting a Card Drive the Bus
Smart Pointer
Mutex
Ownership Checks Happen at Compile Time
Kernel Error Codes as Rust Results
Top Half and Bottom Half Interrupt Handling
Undoing Work on Early Exit with ScopeGuard
Review Tags, Sign-Off and the Developer Certificate of Origin
Running a Kernel in Plain QEMU with a Chosen Device
Drivers for Hardware That Cannot Announce Itself
Telling the Kernel Which Addresses a Device Can Reach
Associated Types and Associated Constants
Returning Errors with Result and the Question Mark Operator
Waiting for the Hardware to Finish
Copying Data To and From a Program's Memory
Proving a Field Is Guarded by Another Lock
Matching the Virtual Card and Reading Its Identity Register
Printing from Rust Kernel Code and Finding the Output
When Driver Code Is Allowed to Sleep
DMA Masks: How Many Address Bits a Device Can Reach
Waiting and Scheduling in Driver Code
Virtual Memory and Page Tables
Deferring Work to a Workqueue
Coherent and Streaming DMA Buffers
Documentation Examples That Run as Tests
Managing Patch Submissions with b4
Uninitialized Memory and How Rust Handles It
Building an Out-of-Tree Module Against a Built Kernel
The Drop Trait
Allocating Memory a Device Can Write Into
System Calls and CPU Privilege Levels in Operating Systems
RFC Patches, Versioned Series and Cover Letters
Sysfs: The Device Model Seen From User Space
Kernel Allocations That Are Allowed to Fail
Reading Kernel Messages with dmesg and Log Levels
Resources That Die with the Device
Studying a Device One Register at a Time
How Linux Binds a Driver to a Device
Initialising a Structure in Place with pin-init
Finding the Right Maintainers and Mailing List
RAII
Dangling Pointer
The module Macro and the Module Trait
Modules, Paths, and Visibility in Rust
Loading and Unloading Kernel Modules
Generating and Browsing the Kernel Rust API Documentation
Registering an Interrupt Handler in Rust
Lifetimes in Rust
Using the Rust Samples Directory as a Curriculum
File Operations: Open, Read, Write and Release
Byte Order and Bit Fields Inside a Register
Structs and Implementation Blocks in Rust
Choosing Kernel Features with Kconfig
Controlling Struct Layout with repr C
The Box Smart Pointer
Core, Alloc, and What no_std Means
Testing a Kernel Driver with Unit Tests and the Lints
Building and Booting a Custom Kernel in QEMU with virtme-ng
Holding C Reference-Counted Objects with ARef
The ioctl Call for Commands That Are Not Reads or Writes
Device Drivers
Running KUnit Tests for the Kernel You Built
Shared Interrupt Lines and Proving the Interrupt Was Yours
The Platform Bus and the Device Tree for Devices That Cannot Be Discovered
Running Commands at a Terminal Command Line
Sized and Unsized Types in Rust
Protecting Driver Data with the Kernel Mutex
Drop Order and Resource Acquisition Is Initialization
References and Borrowing
Telling the Kernel Which Hardware You Drive
The Device You Were Given in probe
Finding Answers in the Kernel Rust Documentation
Unsafe Rust
Unbinding and Unloading a Driver Without Leaking Anything
Pinning: Values That Must Never Move
Stack and Heap Memory
Sharing Driver State with the Kernel Arc
Passing Parameters to a Module at Load Time
Pointer
Send and Sync Traits
Why the Kernel Pins a Minimum Rust Version
Compiling Rust Without Cargo
Letting the Card Interrupt You When the Answer Is Ready
Naming Register Bits and Sizes
User Space and Kernel Space
Handing Ownership to C with ForeignOwnable
Generics and Trait Bounds in Rust
What a Bus Is and Why Devices Sit on One
Getting the Linux Kernel Source Tree
Bus Addresses, Physical Addresses and Virtual Addresses
Device Contexts: Bound, Core, and Normal
Why an Interrupt Handler Must Never Sleep
Polling, Interrupts, and Direct Memory Access
Comparing Your Rust Driver with the C Driver of the Same Device
Writing Unit Tests Inside the Kernel with KUnit
Reading and Writing Device Registers Safely
Built-In Code Versus Loadable Kernel Modules
Linux Kernel
Exposing Your Driver as a Device File
Making the Card Compute a Factorial by Polling
Slices in Rust
Generic Types
Shaping Your Driver as a Patch Series for Upstream
Allocation Flags for Kernel Memory
How Rust Traits Become C Function Tables
Moving a Buffer to the Card with Direct Memory Access
Legacy Pin Interrupts Compared With Message Signalled Interrupts
Linting Kernel Rust Code with Clippy
Why the Next Buses You Meet Use the Same Driver Shape
Iterating Over a Slice with a For Loop
Reading a Kernel Oops and Decoding a Stack Trace
Endianness
Ownership in Rust
Data Race
Setting Up Editor Support for Kernel Rust Code
Bus Enumeration: How a System Finds Its Devices
Turning On the Debug Options That Catch What Rust Cannot
PCI Configuration Space
Turning Commits into a Patch Series
Interrupts vs Polling
Unsafe Blocks and SAFETY Comments in Kernel Rust
Enums and Pattern Matching in Rust
Threaded Interrupt Handlers
Rc and Arc Smart Pointers
Reading a Real Kernel Review Thread Before You Post
Misc Devices: The Short Path to One Device File
The Kernel Crate and Its Prelude
The Driver Trait with probe and unbind
Generated C Bindings and Why Drivers Never Call Them
Memory Safety
What you will learn
No introduction video available
About Twiki
T
Guide profile coming soon.