October 2017
Intermediate to advanced
586 pages
14h 8m
English
As a user program does, a kernel module can accept arguments from the command line. This allows dynamically changing the behavior of the module according to the given parameters, and can avoid the developer having to indefinitely change/compile the module during a test/debug session. In order to set this up, you should first declare the variables that will hold the values of command line arguments, and use the module_param() macro on each of these. The macro is defined in include/linux/moduleparam.h (this should be included in the code too: #include <linux/moduleparam.h>), shown as follows:
module_param(name, type, perm);
This macro contains the following elements: