Skip to content

Commit f7e2186

Browse files
committed
Revise the version magic descriptions for recent kernels
1 parent 3c742b0 commit f7e2186

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lkmpg.tex

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ \subsection{The Simplest Module}
255255
Notice that the dash was replaced by an underscore.
256256
To see what just happened in the logs:
257257
\begin{codebash}
258-
journalctl --since "1 hour ago" | grep kernel
258+
sudo journalctl --since "1 hour ago" | grep kernel
259259
\end{codebash}
260260

261261
You now know the basics of creating, compiling, installing and removing modules.
@@ -336,8 +336,6 @@ \subsection{Hello and Goodbye}
336336

337337
\subsection{The \_\_init and \_\_exit Macros}
338338
\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.
341339
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.
342340
If you think about when the init function is invoked, this makes perfect sense.
343341

@@ -485,19 +483,18 @@ \subsection{Building modules for a precompiled kernel}
485483
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:
486484
487485
\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
489487
\end{verbatim}
490488
491489
Less cryptic information is logged to the systemd journal:
492490
493491
\begin{verbatim}
494-
Jun 4 22: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.358 686 REGPARM 4KSTACKS gcc-3.3'
492+
kernel: poet: disagrees about version of symbol module_layout
496493
\end{verbatim}
497494
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.
501498
To inspect version magics and other strings stored in a given module, issue the command \sh|modinfo module.ko|:
502499
503500
\begin{verbatim}

0 commit comments

Comments
 (0)