FIRST DAY
Linux kernel programming
- Development in the Linux kernel
- Memory allocation
- Linked lists
Exercise: |
Writing the "hello world" kernel module |
Exercise: |
Adding a driver to kernel sources and configuration menu |
Exercise: |
Using module parameters |
Exercise: |
Writing interdependent modules using memory allocations, reference counting and linked lists |
Linux kernel debugging
- The /proc and debugfs filesystems
- Traces
- The kernel Dynamic Debugging interface
- The Kernel Address Sanitizer
- Debugging memory problems with kmemleak
- Using the Undefined Behavior Sanitizer
- Code coverage using gcov
- Debugging with kgdb
- Debugging with a JTAG probe
Exercise: |
Display dynamic traces on the running kernel |
Exercise: |
Debug a module initialization using kgdb |
Kernel multi-tasking
- Task handling
- Concurrent programming
- Timers
- Kernel threads
Exercise: |
Fixing race conditions in the previous lab with mutexes |
SECOND DAY
Introduction to Linux drivers
- Accessing the device driver from user space
- Driver registration
Exercise: |
Step by step implementation of a character driver: |
|
• |
driver registration (major/minor reservation) and device special file creation (/dev) |
Driver I/O functions
- Kernel structures used by drivers
- Opening and closing devices
- Data transfers
- Controlling the device
- Mapping device memory
Exercise: |
Step by step implementation of a character driver: |
|
• |
Implementing open and release |
|
• |
Implementing read and write |
|
• |
Implementing ioctl |
|
• |
Implementing mmap |
THIRD DAY
Synchronous and asynchronous requests
- Task synchronization
- Synchronous request
- Asynchronous requests
Exercise: |
implementation of a pipe-like driver: |
|
• |
implementing waiting and waking |
|
• |
adding non-blocking, asynchronous and multiplexed operations (O_NONBLOCK, SIGIO, poll/select) |
Input/Output and interrupts
- Memory-mapped registers
- Interrupts
- Gpios
- User-level access through /sys or the GPIO character driver
Exercise: |
Polling gpio driver with raw register access |
Exercise: |
Interrupt-based gpio driver with raw register access |
Exercise: |
gpio driver using the gpiolib |
Busses
- Plug-and-Play management
- Static devices declaration
- in the BSP code
- in the device tree
|