Get in Touch

Course Outline

Introduction

  • Brief history of GNU/Linux
  • Licensing models
  • Kernel versioning
  • Release cycles
  • Kernel trees
  • Mainline development
  • Kernel vs. user space
  • Mechanism vs. policy
  • Kernel driver alternatives
  • RTOS vs. Linux

Memory Management

  • Virtual memory vs. physical memory
  • Memory allocation within the kernel
  • Pages
  • Memory zones
  • API
  • Slab allocator

Kernel Patch Management

  • Lifecycle of a patch
  • Git workflows
  • Kernel source code structure
  • Creating patches
  • Checkpatch tools
  • Fixing patches
  • Submitting and shipping patches
  • Audited code standards

Kernel Modules

  • Obtaining kernel sources
  • Configuring, building, and installing modules
  • Device drivers (statically linked, loaded at runtime)
  • Init and exit functions
  • Licensing considerations
  • EXPORT_SYMBOL GPL
  • Out-of-tree Makefiles
  • Module-init-tools
  • Integrating modules into the kernel tree
  • Kconfig configuration
  • Passing parameters to modules
  • Sparse static analysis

Character Drivers

  • Architecture overview
  • User/kernel interface
  • I/O subsystem
  • Virtual File System (VFS)
  • sysfs (devices, bus, drivers, classes)
  • kobject, ktype, and kset
  • Linux kernel driver model
  • Device files
  • Character driver implementation
    • Initialization
    • Registration processes
    • Open and release operations
    • cdev, cdev_add, cdev_del, etc.
    • Major and minor numbers
    • udev, udevmonitor, and udevadm tools

Advanced Character Driver Operations

  • ioctl mechanisms
  • Unlocked ioctl
  • Compat ioctl for compatibility
  • User space API
  • Kernel space API
  • Process lifecycle management
  • Sleeping and blocking techniques
  • Waking up processes
  • Wait queues
  • The thundering herd problem
  • Poll and select operations

Kernel Debugging

  • General debugging strategies
  • Debugging the kernel
    • Binary search with git
    • Debug support provided by the kernel
    • printk, syslogd, klogd, loglevels, rate limiting, debug levels, and selective subsystem debugging
    • Debugging via debugfs queries
    • Oops debugging and forcing oopses
    • Magic SysRq Key usage
    • kgdb and kdb debuggers
    • JTAG debugging

Tracing

  • gcov coverage tools
  • lcov report generation
  • oprofile profiling
  • ftrace
    • nop tracer
    • Function tracer
    • Scheduler switch tracer
    • Function graph tracer
    • Dynamic tracer
  • trace-cmd and kernelshark
  • Perf profiling
  • LTTng tracing framework

Interrupts

  • Interrupts vs. polling
  • Interrupt handling basics
  • Program execution sections
  • Reentrancy considerations
  • Events management
  • Interrupt handler implementation
  • Shared interrupt handlers
  • Interrupt flow control
  • Interrupt control mechanisms

Deferring Work

  • Top halves and bottom halves
  • Softirqs
  • Tasklets
  • Work queues
  • Threaded interrupts

Concurrency

  • Critical regions and sections
  • Atomic operations
  • Race conditions
  • Synchronization techniques
  • Locking strategies
  • Locking solutions
  • Deadlock prevention
  • Contention management
  • Deciding what to lock
  • Available synchronization primitives
    • Atomic operations
    • Spinlocks
    • Reader-writer spinlocks
    • Semaphores
    • Binary semaphores
    • Mutexes
    • Reader-writer semaphores
    • Completion variables
    • Sequential locks
    • Disabling preemption
    • Ordering and memory barriers

Time Management

  • HZ definition
  • Jiffies timing
  • Handling large and small delays
  • Kernel timers

Hardware I/O

  • I/O Ports
  • I/O Memory
  • Handling side effects when accessing registers

User-Kernel Communication

  • put_user() and get_user()
  • copy_to_user() and copy_from_user()
  • Kernel I/O methods
  • Memory mapping
  • procfs interface
  • sysfs interface
  • debugfs interface
  • relayfs interface
  • Netlink sockets
  • ioctl mechanisms

Portability

  • Word size considerations
  • Opaque types
  • Signed vs. unsigned char
  • Data alignment
  • Integral promotion rules
  • Code reuse strategies
  • Endianness handling
  • System tick variations
  • Page size differences
  • Instruction ordering
  • SMP, preemption, and high memory management

Except where otherwise noted, content and this course outline are licensed under Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).

Requirements

  • 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 previously (strongly recommended!) and/or have a good understanding of the topics outlined there
 35 Hours

Number of participants


Price per participant

Testimonials (3)

Upcoming Courses

Related Categories