22 * modprobe configuration files
23 * /sys/module/*/parameters/
27 * include linux/module.h
28 * include linux/init.h
30 # Init and Exit Functions
32 We use *module\\_init* and *module\\_exit* to declare our init and exit
35 The *\\_\\_init* and *\\_\\_exit* marks allow the kernel to remove them when
36 they are not needed, reducing memory consumption.
40 *printk* is very similar to printf. The messages are usually preceded by a
41 string in the form \<n\>, where *n* is a priority. There are macros, like
42 *KERN\\_ALERT* and *KERN\\_DEBUG* to use for that.
46 *MODULE\\_LICENSE* is highly recommended. A free software license should be
47 used, otherwise the kernel is tainted. This indicates to developers that
48 something has gone wrong, and some bug reports are ignored some times.
50 # Building out-of-tree
52 Building an out-of-tree linux module is very simple.
54 Let's take a look at a simple command line and a simple Makefile.
56 # Module description definitios
60 * MODULE\\_DESCRIPTION
67 Besides *MODULE\\_PARM\\_DESC* to inform user about the parameter, we must use
70 module\\_param(name, type, perm);
74 * include linux/slab.h