
Learn how device drivers control hardware devices, communicate with hardware via registers and memory maps, register with the kernel using kernel APIs, and expose access through device files.
Learn how kernel modules extend the kernel as loadable code, enabling device drivers to communicate with hardware, and how to load or unload these modules from the /lib/modules directory.
Explore how device drivers relate to kernel modules, comparing built-in versus module loading, and weigh memory savings, dynamic loading, debugging ease, and security risks in kernel design.
Explore two types of kernel modules—those inside the Linux source and out-of-tree modules distributed separately—and describe the development workflow from initial submission through maintainer review to inclusion in the kernel.
Learn how to view and inspect kernel modules using lsmod and modinfo, identify loaded modules, their dependencies, sizes, versions, licenses, and configurable parameters.
Write a hello world linux kernel module with init and exit using module_init and module_exit, specify license, and print with printk; build and load with insmod, lsmod, and rmmod.
Contrast printf in user space with printk in the kernel, noting log levels and buffering, and that printf relies on the standard library while printk handles kernel messages.
Update the makefile to add a default target all and a clean target, enabling one-command builds with make and one-command cleanups for Linux kernel modules.
Insmod triggers a kernel load sequence where user space calls the kernel, checks permissions, copies the module from user space, and runs the module's init function.
Returning a non-zero value from a kernel module init function signals failure and prevents the module from loading, evidenced by error messages in the kernel log.
Change the kernel module name by editing the Makefile, listing required object files, and rebuilding with make to produce a module with your chosen name.
learn how to compile a kernel module spanning multiple c files by updating the makefile to include all object files, resolving undefined symbol errors, and loading the module for verification.
Learn to build two kernel modules from a single makefile by updating the makefile rules with plus equals, generate and load modules, and perform basic tests.
Learn how dmesg reads the kernel ring buffer, prints or clears the contents, and uses timestamps and local levels to filter messages.
Watch new kernel messages in real time using the dmesg follow option. Learn to run commands in background to observe logs during driver debugging.
Learn how a Linux kernel module with module_init only behaves when loaded and attempted to unload, revealing that absence of an exit function prevents removal and triggers errors.
This lecture demonstrates a Linux kernel module example that uses only an exit function, shows loading the module, and explains handling modules with or without an innate function.
Explore a minimal linux kernel module by removing init and exit functions, load and unload it to observe behavior, and understand how function definitions expose APIs for other modules.
Discover how to cross compile the kernel for a target machine by setting environment variables, overriding the top-level makefile defaults, and using a suitable cross compiler.
Trace the journey from C source code to a loadable kernel object, exploring kernel module basics in Linux kernel programming.
Unpack how external symbols shape module builds and the compilation order, with practical examples of make, handling objects, and assembling a single-file versus multi-file kernel module.
Explore the differences between insmod and modprobe, focusing on loading order and dependency handling, and learn how modules are loaded from the standard location with dependencies loaded first.
Explore how modprobe determines module dependencies using modules.dep and depmod, and understand how the dependency graph guides kernel module loading.
Learn how Linux kernel module_init and module_exit functions manage module lifecycles by handling function pointers, void functions, and alias names in kernel code.
Explore how gcc attribute alias lets you create multiple aliases for a symbol, such as a function, by declaring and defining alternate names.
Explore how motivation, timing, and function execution relate to Linux kernel programming concepts, while examining messages about international audiences, motives, and clear naming.
Learn how to pass parameters to Linux kernel modules using environment and argument values, set default or explicit values, and print parameter results to observe module behavior.
Explore how the kernel handles incorrect values passed to module parameters, including invalid inputs and the resulting behavior when modules are loaded or not.
Learn how to pass parameters to builtin modules in the Linux kernel, exploring argument handling and practical techniques to manage module inputs.
Explore how to pass a string with multiple words as a parameter in Linux kernel programming, and examine word and space handling in practice.
Explore what happens when you pass zero to the permission argument of the module_param macro in Linux kernel programming.
Learn how to pass arrays as module parameters in the Linux kernel. Explore how arguments are separated by commas, counted as elements, and how the kernel handles excessive input.
Explore boolean values and the inverse operation, including how default values and input from the command line affect true or false. Illustrate with a simple example that prints the result.
Explore what a symbol is—a name that can store data or instructions—and how symbols are combined into a symbol table containing names and addresses, used during system startup.
Learn how exporting symbols exposes particular behaviors in the kernel, and how licensing and the symbology of exports determine what is accessible.
Learn linux kernel programming: system.map vs /proc/kallsyms explains how the static system.map lists symbols, while /proc/kallsyms exposes runtime symbols, including those from dynamically loaded modules.
Explore how a Linux kernel module exports a function by exporting symbols to the kernel, with practical examples.
Explore module stacking in Linux kernel programming by examining how modules export and rely on symbols, manage dependencies, and load or remove modules.
Explore how a Linux kernel module exports a variable, then define, load, and verify the exported symbol with a practical example.
Explore version magic in Linux kernel programming by analyzing configurations, final configurations, and the role of models in determining system behavior.
Explore what happens when you omit the MODULE_LICENSE macro in a Linux kernel module, highlighting license unspecified and license underspecified as common errors.
Identify how a tainted kernel arises when loading incompatible or not fully tested drivers, and explain why the community cannot support the tainted state.
Learn how to check if the kernel is tainted by the taint value: zero means not tainted, non-zero means tainted, using the Gunnell script to interpret taint values.
Explore what happens when you specify an invalid license, such as abc, in Linux kernel programming and how lack of license validation may show abc.
Learn how non-GPL kernel modules try to access symbols from GPL modules, the licensing constraints, and how the kernel warns and enforces access to exported symbols.
Discover how to identify the kernel version from a .ko module using practical debugging steps and tool-assisted checks in Linux kernel programming.
learn how kernel module metadata and macros provide descriptions, version and license details, and how hashes enable verification of loaded code across clients.
Explore how the module_info macro is defined in kernel source files and how it embeds metadata such as license, name, and tag-value information for Linux modules.
Use objdump to inspect a kernel module, listing its sections and displaying the more info content, including license details and embedded information.
Explore what happens when printk is called repeatedly, examining buffer size, message contents, and whether continuous calls overwrite existing log entries in the kernel.
Discover how to determine and adjust the printk kernel ring buffer size. Change the log buffer by configuring kernel options or updating bootloader settings and recompiling.
Examine how printk log levels govern kernel messages by using emergency, alert, and critical macros, and verify behavior by compiling code and observing warnings and logs.
Learn what happens when you omit a log level in a low level kernel module, and confirm that the default printk log level is 1. Understand how console log level and related settings control what messages appear on the serial port, including the console device, minimum console level, and a maximum level of seven.
Understand how kernel messages appear on the console, why graphics mode hides them, and how to switch to console and adjust the console log level to display warnings and errors.
Learn to use short printk macros to write compact, readable kernel log messages in init and exit paths, control log levels, and build and load a kernel module.
Enable pr_debug messages in a linux kernel module by defining a debug macro in the makefile, and verify via loading and unloading the module to observe kernel logs.
Demonstrate a Linux kernel module example that prints a floating point number, and reveal how the kernel warns against unsupported format specifiers like %f and errors when scaling changes.
Kernel space keeps floating point unit off to avoid overhead; user-space floating point operations trigger a trap, switch to fp mode, restore state, and return, with non-fpu architectures using emulation.
Discover how a printk rate limit controls kernel log messages to prevent ring buffer overflow, allowing bursts then resuming after a time interval.
Explore how printk_once limits printk messages by ensuring a specific line prints only once, regardless of repeated calls, with examples showing per-line behavior.
Explore Linux kernel programming by examining printk output, the default newline behavior, and how to use line continuation to print messages on a single line.
Learn to print hex dumps of buffers with a plain text dump function. Configure log level, prefix, offset or address, and 16- or 32-byte lines with optional ASCII output.
Use print_hex_dump_bytes to print hex and ASCII dumps with a simple prefix, debug level, and configurable group sizes, choosing text or bytes output.
Explore dynamic debugging techniques in the Linux kernel, focusing on dynamically enabling or disabling features through configuration to gather additional information and troubleshoot complex system behavior.
Demonstrates what happens when you try to load a non-ko file with insmod. The example highlights errors such as invalid argument and invalid parameters.
Observe how strace traces the insmod command to load and unload kernel modules, revealing the involved system calls and open parameters during module management.
Learn how to determine a Linux kernel module name from its .ko file and verify the module during loading using practical steps shown in the demo.
Learn to dump the kernel stack by tracing a system call, printing the call stack and CPU registers, and observing module loading and function execution.
Learn how kernel panic halts the Linux system to prevent data loss, triggers the panic function, dumps debug information, and forces reboot options via the command line or /proc.
Trigger a phantom kernel panic to observe how the system restarts after a delay, and examine how configuration options influence panic behavior.
Explore the difference between panic and oops in linux kernel programming; oops allows continuation after an invalid memory fault and prints a backtrace to aid debugging, while panic halts execution.
examine an invalid memory access to a physical address, see how the kernel kills the offending process and prints debug data, then locate the exact line using dtv and ddt.
Explore how bugs arise in the Linux kernel and how the BUG_ON macro helps catch invalid conditions. See how lines that should not execute reveal incomplete code for kernel debugging.
Identify why a kernel module cannot be removed when it is in use or not successfully loaded, and explain the conditions that prevent module removal after bug or oops.
Define preprocessing symbols in a Makefile to enable conditional compilation across all source files, by passing define flags through C flags and applying them uniformly to the build.
Learn to determine how many cpus a system has from user space and kernel space using a processor file that lists each processor and online cpus, as shown in example.
Learn how the Linux kernel represents a process as a large task structure in a global task list, with executable name and states like running, interruptible sleep, and uninterruptible sleep.
Learn how a Linux kernel module traverses the task list, prints each process name and state, and converts states to strings for readable output across systems.
Learn how a Linux kernel module uses the current macro to access the executing task and its name, with architecture-specific implementation and module load/exit.
Explore a Linux kernel module example that uses the current macro to reference the task and print processes, illustrating how only the current task may appear.
Develop a Linux kernel module that accepts a pid and prints the process and its parent, using a simple task-list pattern match with systemd and swapper.
Explore how a process’s address space defines its virtual area, including core, data, stack, and environment segments, and how memory mappings are exposed via the proc filesystem's maps file.
Learn to implement a Linux kernel module that prints a process memory map, detailing code and data segments, anonymous mappings, and the linked list structures that enumerate memory regions.
110+ Lectures on Linux Kernel Programming
Updated on Dec 12th 2020 : Added more videos in Bonus section
Do you want to expand your horizon and be a part of programming evolution? Would you like to become proficient in Linux Kernel Module Programming to gain skills that are valued by the programming industry?
And why not? After all, Linux is one of the most popular OS for software developers, and its popularity is only going to increase over time.
There are many Linux Kernel Module Programming courses available to learn these skills.
However, these courses are often lacking in the practical approach, and students often feel left behind.
So, what is the best course available to learn this valuable skill right now?
Introducing Learn Linux Kernel Programming, a high-quality course developed by Linux Weekend Learning.
This course is built on a practical approach and uses a lot of real-world examples to give you proper training.
By enrolling, you will have lifetime access to course. You can learn at your own pace and refer back them whenever you want!
Here are some of the perks of this course:
Over 5 hours of video teaching and training
100+ Lectures on Linux Kernel Programming
Understanding the in and out of the hello world kernel modules
Write various kernel modules which exports symbols, accepts parameters, creates kernel threads
Learn about the printk function in deep
Various commands used while working in Linux Kernel Modules:insmod, rmmod, modprobe, lsmod, dmesg
All examples and notes used in the course are available for download
Direct access to your instructors for questions and help through the Udemy communication channels
Lifetime access to the course, including all future updates
This course comes with a 30 day money back guaranteed!. If you are not satisfied with the course, you'll get your money back
So what are you waiting for, enroll now and take the next step in learning Linux Kernel Programming
Commands you will learn from this course:
lsmod
dmesg
insmod
rmmod
modprobe
modinfo
depmod
objdump
ps -l
API's covered in the course:
module_param
module_param_array
EXPORT_SYMBOL
EXPORT_SYMBOL_GPL
MODULE_INFO
KBUILD_MODNAME
dump_stack
panic
BUG()
for_each_process
num_online_cpus
printk_rate_limit
printk_once
print_hex_dump
print_hex_dump_bytes
current
kthread_create
wake_up_process
kthread_stop
kthread_should_stop
kthread_run
usleep_range
msleep
smp_processor_id
VERMAGIC_STRING