Get in Touch

Course Outline

Introduction

  • Historical overview of GNU/Linux
  • Licensing frameworks
  • Kernel versioning strategies
  • Release cycles
  • Kernel source trees
  • The mainline kernel
  • Distinguishing kernel space from user space
  • Mechanisms versus policies
  • Alternatives for kernel drivers
  • RTOS compared to Linux

Memory Management

  • Virtual versus physical memory
  • Kernel memory allocation methods
  • Understanding pages
  • Memory zones
  • Relevant APIs
  • The slab allocator

Kernel Patches

  • Patch lifecycle
  • Using git for version control
  • Navigating kernel source
  • Creating patches
  • Reviewing patches
  • Fixing patch issues
  • Distributing patches
  • Audited code standards

Kernel Modules

  • Obtaining kernel sources
  • Configuration, building, and installation
  • Device drivers (static linking and runtime loading)
  • Initialization and exit functions
  • Licensing requirements
  • EXPORT_SYMBOL GPL
  • Managing out-of-tree makefiles
  • Module initialization tools
  • Integrating modules within the kernel tree
  • Kconfig configuration
  • Passing parameters to modules
  • Using sparse for static analysis

Character Drivers

  • Architectural design
  • User and kernel interface boundaries
  • The I/O subsystem
  • Virtual File System (VFS)
  • sysfs (devices, buses, drivers, classes)
  • kobject, ktype, and kset structures
  • The Linux kernel driver model
  • Device file management
  • Character driver implementation

    • Initialization procedures
    • Registration processes
    • Open and release operations
    • cdev, cdev_add, cdev_del, and related functions
    • Major and minor number allocation
    • udev, udevmonitor, and udevadm utilities

Advanced Character Driver Operations

  • ioctl operations
  • Unlocked ioctl implementation
  • Compat ioctl handling
  • User-space APIs
  • Kernel-space APIs
  • Process lifecycle management
  • Sleeping and blocking mechanisms
  • Waking up processes
  • Wait queues
  • Addressing the 'thundering herd' problem
  • Poll and select operations

Kernel Debugging

  • General debugging techniques
  • Debugging the kernel

    • Using git for binary search debugging
    • Leveraging kernel debug support
    • printk, syslogd, klogd, log levels, rate limiting, and selective subsystem debugging
    • Querying debugfs for diagnostics
    • Handling and analyzing kernel oops
    • Utilizing the Magic SysRq Key
    • Using kgdb and kdb
    • JTAG debugging

Tracing

  • gcov coverage
  • lcov report generation
  • oprofile profiling
  • ftrace capabilities

    • NOP tracer
    • Function tracer
    • Scheduler switch tracer
    • Function graph tracer
    • Dynamic tracing
  • Using trace-cmd and kernelshark
  • perf profiling
  • LTTng tracing

Interrupts

  • Interrupts versus polling
  • Interrupt handling fundamentals
  • Program execution sections
  • Reentrancy issues
  • Event handling
  • Interrupt handler design
  • Shared interrupt handler implementation
  • Interrupt flow control
  • Interrupt management strategies

Deferring Work

  • Top half and bottom half processing
  • Soft interrupts (softirqs)
  • Tasklets
  • Work queues
  • Threaded interrupts

Concurrency

  • Critical regions and sections
  • Atomic operations
  • Race conditions
  • Synchronization techniques
  • Locking mechanisms
  • Locking solutions overview
  • Deadlock prevention
  • Contention management
  • Determining what requires locking
  • Available locking primitives

    • Atomic operations
    • Spin locks
    • Reader-writer spin locks
    • Semaphores
    • Binary semaphores
    • Mutexes
    • Reader-writer semaphores
    • Completion variables
    • Sequence locks
    • Disabling preemption
    • Ordering and memory barriers

Time Management

  • The HZ tick rate
  • Jiffies timer
  • Implementing large versus small delays
  • Kernel timer implementations

Hardware I/O

  • I/O Ports access
  • I/O Memory mapping
  • Handling side effects during register access

User-Kernel Communication

  • put_user() and get_user() functions
  • copy_to_user() and copy_from_user() functions
  • Kernel I/O interfaces
  • Memory mapping techniques
  • procfs file system
  • sysfs file system
  • debugfs file system
  • relayfs file system
  • Netlink sockets
  • ioctl mechanisms

Portability

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

Unless stated otherwise, the content and this course outline are licensed under Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0).

Requirements

  • Fundamental familiarity using a GNU/Linux system as an end user
  • Basic proficiency with command-line shells
  • Foundational knowledge of user-space application development
  • Intermediate-level C programming skills
  • It is highly recommended to have previously attended the Embedded GNU/Linux Systems Architecture course, or possess a strong grasp of the topics covered in that curriculum.
 35 Hours

Testimonials (3)

Upcoming Courses

Related Categories