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
You now know the basics of creating, compiling, installing and removing modules.
@@ -336,8 +336,6 @@ \subsection{Hello and Goodbye}
336
336
337
337
\subsection{The \_\_init and \_\_exit Macros}
338
338
\label{init_n_exit}
339
-
This demonstrates a feature of kernel 2.2 and later.
340
-
Notice the change in the definitions of the init and cleanup functions.
341
339
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.
342
340
If you think about when the init function is invoked, this makes perfect sense.
343
341
@@ -485,19 +483,18 @@ \subsection{Building modules for a precompiled kernel}
485
483
Now, if you just install a kernel source tree, use it to compile your kernel module and you try to insert your module into the kernel, in most cases you would obtain an error as follows:
486
484
487
485
\begin{verbatim}
488
-
insmod: error inserting 'poet_atkm.ko': -1 Invalid module format
486
+
insmod: ERROR: could not insert module poet.ko: Invalid module format
489
487
\end{verbatim}
490
488
491
489
Less cryptic information is logged to the systemd journal:
492
490
493
491
\begin{verbatim}
494
-
Jun 422:07:54 localhost kernel: poet_atkm: version magic '2.6.5-1.358custom 686
495
-
REGPARM 4KSTACKS gcc-3.3' should be '2.6.5-1.358686 REGPARM 4KSTACKS gcc-3.3'
492
+
kernel: poet: disagrees about version of symbol module_layout
496
493
\end{verbatim}
497
494
498
-
In other words, your kernel refuses to accept your module because version strings (more precisely, version magics) do not match.
499
-
Incidentally, version magics are stored in the module object in the form of a static string, starting with vermagic:.
500
-
Version data are inserted in your module when it is linked against the \verb|init/vermagic.o| file.
495
+
In other words, your kernel refuses to accept your module because version strings (more precisely, \textit{version magic}, see \src{include/linux/vermagic.h}) do not match.
496
+
Incidentally, version magic strings are stored in the module object in the form of a static string, starting with \cpp|vermagic:|.
497
+
Version data are inserted in your module when it is linked against the \verb|kernel/module.o| file.
501
498
To inspect version magics and other strings stored in a given module, issue the command \sh|modinfo module.ko|:
0 commit comments