Agenda for Training course Embedded GNU/Linux Device Drivers
This 3-day training class uses hands-on exercises combined with instruction to illustrate the concepts of GNU/Linux kernel internals and device driver development. It is designed to bring you quickly up to speed. We describe processes, concepts and commands necessary to write GNU/Linux device drivers through a combination of theory and on-the-job training. Don’t reinvent the wheel, but learn from an experienced trainer and take home a working knowledge and the ability to use it effectively in your own embedded development project.
Prerequisites
- Basic familiarity with using a GNU/Linux system as an end user
- Basic familiarity with a command line shell
- Basic knowledge of user space / application development
- Intermediate C programming knowledge
- Should have attended Embedded GNU/Linux Systems Architecture before (strongly recommended!)
Who should attend?
People with interest in or tasked with the development or evaluation of developing GNU/Linux device drivers like software engineers, field engineers, (project) managers, hardware engineers.
Course Outline
Note: There are many different classes of device drivers - a
driver for a DAC connected tho the I2C bus and a driver for a camera
attached to a FPGA interfacing to the V4L subsystem may have a few
things in common, but if you look closer, they are totally different
beasts. It is impossible to cover all classes of drivers in depth in
any kind of training class - please understand the following list as
of frequent topics, where we will pick from on demand of the
participants of each class - and also we may add additional topics
if wanted/needed. So there will not be any two identical classes -
this is always more of a dedicated workshop for your specific needs
instead of a canned (and useless) standard course.
Introduction
- quick history of GNU/Linux
- licensing
- kernel versioning
- release cycle
- kernel trees
- mainline
- kernel vs. user space
- mechanism vs. policy
- kernel driver alternatives
- RTOS vs. Linux
Memory Management
- Virtual memory vs. physical memory
- memory allocation in kernel
- pages
- zones
- API
- slab
Kernel Patch
- life cycle
- git
- kernel source
- create patch
- check patch
- fix patch
- ship patch
- audited code
Kernel Module
- get kernel sources
- configure
- build
- install
- device drivers (statically linked, loaded at runtime)
- init
- licensing
- EXPORT SYMBOL GPL
- out of tree makefile
- module-init-tools
- module in kernel tree
- Kconfig
- parameter passing
- sparse
Char Drivers
- architecture
- user/kernel interface
- I/O subsystem
- VFS
- sysfs (devices, bus, drivers, classes)
- kobject
- ktype
- kset
- linux kernel driver model
- device files
- char driver
- initialization
- registration
- open, release
- cdev, cdev add, cdev del,...
- major/minor numbers
- udev, udevmonitor, udevadm
Advanced Character Driver Operations
- ioctl
- unlocked ioctl
- compat ioctl
- user space API
- kernel space API
- process lifecycle
- sleeping/blocking
- sleeping/waking up
- wait queue
- thundering herd
- poll/select
Kernel Debugging
- bug
- debugging
- debugging the kernel
- binary search with git
- debug support from kernel
- printk
- syslogd
- klogd
- loglevels
- rate limit
- debug levels
- debug selective subsystems
- debugging by querying debugfs
- oops debugging, asserting oops
- Magic SysRq? Key
- kgdb/kdb
- JTAG
Tracing
- gcov
- lcov
- oprofile
- ftrace
- nop tracer
- function tracer
- sched switch tracer (viewer)
- function graph tracer
- dynamic tracer
- LTTng
Interrupts
- interrupts vs. polling
- interrupt
- program sections
- reentrancy
- events
- interrupt handler
- shared interrupt handler
- interrupt flow
- interrupt control
Deferring Work
- top/bottom halves
- softirqs
- tasklets
- work queues
Concurrency
- critical region/section
- atomic
- race condition
- synchronization
- locking
- locking solutions
- deadlock
- contention
- what to lock?
- what to use?
- atomic operations
- spin locks
- reader-writer spin locks
- semaphore
- binary semaphore
- mutex
- reader-writer semaphore
- completion variables
- sequential locks
- disable preemption
- orderig and barriers
Time
- HZ
- Jiffies
- big/small delays
- kernel timers
Hardware I/O
- I/O Ports
- I/O Memory
- How to deal with side effects accessing registers?
User-Kernel Communication
- put(get) user()
- copy to(from) user()
- Kernel I/O
- memory mapping
- procfs
- sysfs
- debugfs
- relayfs
- netlink
- ioctl
Portability
- word size
- opaque types
- signed/unsigned char
- data alignment
- integral promotion
- code reuse
- endianess
- system tick
- page size
- instruction ordering
- SMP/preemption/high memory