You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lkmpg.tex
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -493,7 +493,7 @@ \subsection{Hello and Goodbye}
493
493
the last time you ran \sh|make menuconfig| or something similar.
494
494
495
495
\subsection{The \_\_init and \_\_exit Macros}
496
-
\label{init_n_exit}
496
+
\label{sec:init_n_exit}
497
497
The \cpp|__init| macro causes the init function to be discarded and its memory freed once the init function finishes for built-in drivers, but not loadable modules.
498
498
If you think about when the init function is invoked, this makes perfect sense.
499
499
@@ -508,7 +508,7 @@ \subsection{The \_\_init and \_\_exit Macros}
508
508
\samplec{examples/hello-3.c}
509
509
510
510
\subsection{Licensing and Module Documentation}
511
-
\label{modlicense}
511
+
\label{sec:modlicense}
512
512
Honestly, who loads or even cares about proprietary modules?
513
513
If you do then you might have seen something like this:
514
514
\begin{verbatim}
@@ -527,7 +527,7 @@ \subsection{Licensing and Module Documentation}
527
527
\samplec{examples/hello-4.c}
528
528
529
529
\subsection{Passing Command Line Arguments to a Module}
530
-
\label{modparam}
530
+
\label{sec:modparam}
531
531
Modules can take command line arguments, but not with the argc/argv you might be used to.
532
532
533
533
To allow arguments to be passed to your module, declare the variables that will take the values of the command line arguments as global and then use the \cpp|module_param()| macro (defined in \src{include/linux/moduleparam.h}) to set the mechanism up.
@@ -600,7 +600,7 @@ \subsection{Passing Command Line Arguments to a Module}
600
600
\end{verbatim}
601
601
602
602
\subsection{Modules Spanning Multiple Files}
603
-
\label{modfiles}
603
+
\label{sec:modfiles}
604
604
Sometimes it makes sense to divide a kernel module between several source files.
First we invent an object name for our combined module, second we tell \sh|make| what object files are part of that module.
635
635
636
636
\subsection{Building modules for a precompiled kernel}
637
-
\label{precompiled}
637
+
\label{sec:precompiled}
638
638
Obviously, we strongly suggest you to recompile your kernel, so that you can enable a number of useful debugging features, such as forced module unloading (\cpp|MODULE_FORCE_UNLOAD|): when this option is enabled, you can force the kernel to unload a module even when it believes it is unsafe, via a \sh|sudo rmmod -f module| command.
639
639
This option can save you a lot of time and a number of reboots during the development of a module.
640
640
If you do not want to recompile your kernel then you should consider running the examples within a test distribution on a virtual machine.
0 commit comments