mirror of
https://github.com/bashrc/LKMPG.git
synced 2018-06-11 03:06:54 +02:00
Tidying
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<!-- 2016-03-09 Wed 16:16 -->
|
||||
<!-- 2016-03-09 Wed 16:27 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>The Linux Kernel Module Programming Guide</title>
|
||||
@@ -377,7 +377,7 @@ If you publish or distribute this book commercially, donations, royalties, and/o
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The Linux Kernel Module Programming Guide was originally written for the 2.2 kernels by Ori Pomerantz. Eventually, Ori no longer had time to maintain the document. After all, the Linux kernel is a fast moving target. Peter Jay Salzman took over maintenance and updated it for the 2.4 kernels. Eventually, Peter no longer had time to follow developments with the 2.6 kernel, so Michael Burian became a co-maintainer to update the document for the 2.6 kernels. Bob Mottram updated the examples for 3.8 and 3.16 kernels.
|
||||
The Linux Kernel Module Programming Guide was originally written for the 2.2 kernels by Ori Pomerantz. Eventually, Ori no longer had time to maintain the document. After all, the Linux kernel is a fast moving target. Peter Jay Salzman took over maintenance and updated it for the 2.4 kernels. Eventually, Peter no longer had time to follow developments with the 2.6 kernel, so Michael Burian became a co-maintainer to update the document for the 2.6 kernels. Bob Mottram updated the examples for 3.8 and 3.16 kernels and modified or updated some chapters.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -588,67 +588,41 @@ This will tell you what kernel header files are available. Then for example:
|
||||
<h4 id="orgheadline7">Before We Begin</h4>
|
||||
<div class="outline-text-4" id="text-orgheadline7">
|
||||
<p>
|
||||
Before we delve into code, there are a few issues we need to cover.
|
||||
Everyone's system is different and everyone has their own groove. Getting
|
||||
your first "hello world" program to compile and load correctly can sometimes
|
||||
be a trick. Rest assured, after you get over the initial hurdle of doing it
|
||||
for the first time, it will be smooth sailing thereafter.
|
||||
Before we delve into code, there are a few issues we need to cover. Everyone's system is different and everyone has their own groove. Getting your first "hello world" program to compile and load correctly can sometimes be a trick. Rest assured, after you get over the initial hurdle of doing it for the first time, it will be smooth sailing thereafter.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<ul class="org-ul"><li><a id="orgheadline8"></a>Modversioning<br /><div class="outline-text-5" id="text-orgheadline8">
|
||||
<p>
|
||||
A module compiled for one kernel won't load if you boot a different kernel
|
||||
unless you enable CONFIG_MODVERSIONS in the kernel. We won't go into module
|
||||
versioning until later in this guide. Until we cover modversions, the
|
||||
examples in the guide may not work if you're running a kernel with
|
||||
modversioning turned on. However, most stock Linux distro kernels come with
|
||||
it turned on. If you're having trouble loading the modules because of
|
||||
versioning errors, compile a kernel with modversioning turned off.
|
||||
A module compiled for one kernel won't load if you boot a different kernel unless you enable CONFIG_MODVERSIONS in the kernel. We won't go into module versioning until later in this guide. Until we cover modversions, the examples in the guide may not work if you're running a kernel with modversioning turned on. However, most stock Linux distro kernels come with it turned on. If you're having trouble loading the modules because of versioning errors, compile a kernel with modversioning turned off.
|
||||
</p>
|
||||
</div></li>
|
||||
|
||||
<li><a id="orgheadline9"></a>Using X<br /><div class="outline-text-5" id="text-orgheadline9">
|
||||
<p>
|
||||
It is highly recommended that you type in, compile and load all the examples
|
||||
this guide discusses. It's also highly recommended you do this from a
|
||||
console. You should not be working on this stuff in X.
|
||||
It is highly recommended that you type in, compile and load all the examples this guide discusses. It's also highly recommended you do this from a console. You should not be working on this stuff in X.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Modules can't print to the screen like printf() can, but they can log
|
||||
information and warnings, which ends up being printed on your screen, but
|
||||
only on a console. If you insmod a module from an xterm, the information and
|
||||
warnings will be logged, but only to your log files. You won't see it unless
|
||||
you look through your log files. To have immediate access to this
|
||||
information, do all your work from the console.
|
||||
Modules can't print to the screen like printf() can, but they can log information and warnings, which ends up being printed on your screen, but only on a console. If you insmod a module from an xterm, the information and warnings will be logged, but only to your log files. You won't see it unless you look through your log files. To have immediate access to this information, do all your work from the console.
|
||||
</p>
|
||||
</div></li>
|
||||
|
||||
<li><a id="orgheadline10"></a>Compiling Issues and Kernel Version<br /><div class="outline-text-5" id="text-orgheadline10">
|
||||
<p>
|
||||
Very often, Linux distros will distribute kernel source that has been patched
|
||||
in various non-standard ways, which may cause trouble.
|
||||
Very often, Linux distros will distribute kernel source that has been patched in various non-standard ways, which may cause trouble.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A more common problem is that some Linux distros distribute incomplete kernel
|
||||
headers. You'll need to compile your code using various header files from the
|
||||
Linux kernel. Murphy's Law states that the headers that are missing are
|
||||
exactly the ones that you'll need for your module work.
|
||||
A more common problem is that some Linux distros distribute incomplete kernel headers. You'll need to compile your code using various header files from the Linux kernel. Murphy's Law states that the headers that are missing are exactly the ones that you'll need for your module work.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To avoid these two problems, I highly recommend that you download, compile
|
||||
and boot into a fresh, stock Linux kernel which can be downloaded from any of
|
||||
the Linux kernel mirror sites. See the Linux Kernel HOWTO for more details.
|
||||
To avoid these two problems, I highly recommend that you download, compile and boot into a fresh, stock Linux kernel which can be downloaded from any of the Linux kernel mirror sites. See the Linux Kernel HOWTO for more details.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Ironically, this can also cause a problem. By default, gcc on your system may
|
||||
look for the kernel headers in their default location rather than where you
|
||||
installed the new copy of the kernel (usually in <i>usr/src</i>. This can be fixed
|
||||
by using gcc's -I switch.
|
||||
Ironically, this can also cause a problem. By default, gcc on your system may look for the kernel headers in their default location rather than where you installed the new copy of the kernel (usually in <i>usr/src</i>. This can be fixed by using gcc's -I switch.
|
||||
</p>
|
||||
</div></li></ul>
|
||||
</div>
|
||||
|
||||
@@ -19,7 +19,7 @@ If you publish or distribute this book commercially, donations, royalties, and/o
|
||||
|
||||
*Authorship*
|
||||
|
||||
The Linux Kernel Module Programming Guide was originally written for the 2.2 kernels by Ori Pomerantz. Eventually, Ori no longer had time to maintain the document. After all, the Linux kernel is a fast moving target. Peter Jay Salzman took over maintenance and updated it for the 2.4 kernels. Eventually, Peter no longer had time to follow developments with the 2.6 kernel, so Michael Burian became a co-maintainer to update the document for the 2.6 kernels. Bob Mottram updated the examples for 3.8 and 3.16 kernels.
|
||||
The Linux Kernel Module Programming Guide was originally written for the 2.2 kernels by Ori Pomerantz. Eventually, Ori no longer had time to maintain the document. After all, the Linux kernel is a fast moving target. Peter Jay Salzman took over maintenance and updated it for the 2.4 kernels. Eventually, Peter no longer had time to follow developments with the 2.6 kernel, so Michael Burian became a co-maintainer to update the document for the 2.6 kernels. Bob Mottram updated the examples for 3.8 and 3.16 kernels and modified or updated some chapters.
|
||||
|
||||
*Versioning and Notes*
|
||||
|
||||
@@ -138,53 +138,27 @@ sudo apt-get install linux-headers-3.16.0-4-amd64
|
||||
|
||||
*** Before We Begin
|
||||
|
||||
Before we delve into code, there are a few issues we need to cover.
|
||||
Everyone's system is different and everyone has their own groove. Getting
|
||||
your first "hello world" program to compile and load correctly can sometimes
|
||||
be a trick. Rest assured, after you get over the initial hurdle of doing it
|
||||
for the first time, it will be smooth sailing thereafter.
|
||||
Before we delve into code, there are a few issues we need to cover. Everyone's system is different and everyone has their own groove. Getting your first "hello world" program to compile and load correctly can sometimes be a trick. Rest assured, after you get over the initial hurdle of doing it for the first time, it will be smooth sailing thereafter.
|
||||
|
||||
**** Modversioning
|
||||
|
||||
A module compiled for one kernel won't load if you boot a different kernel
|
||||
unless you enable CONFIG_MODVERSIONS in the kernel. We won't go into module
|
||||
versioning until later in this guide. Until we cover modversions, the
|
||||
examples in the guide may not work if you're running a kernel with
|
||||
modversioning turned on. However, most stock Linux distro kernels come with
|
||||
it turned on. If you're having trouble loading the modules because of
|
||||
versioning errors, compile a kernel with modversioning turned off.
|
||||
A module compiled for one kernel won't load if you boot a different kernel unless you enable CONFIG_MODVERSIONS in the kernel. We won't go into module versioning until later in this guide. Until we cover modversions, the examples in the guide may not work if you're running a kernel with modversioning turned on. However, most stock Linux distro kernels come with it turned on. If you're having trouble loading the modules because of versioning errors, compile a kernel with modversioning turned off.
|
||||
|
||||
**** Using X
|
||||
|
||||
It is highly recommended that you type in, compile and load all the examples
|
||||
this guide discusses. It's also highly recommended you do this from a
|
||||
console. You should not be working on this stuff in X.
|
||||
It is highly recommended that you type in, compile and load all the examples this guide discusses. It's also highly recommended you do this from a console. You should not be working on this stuff in X.
|
||||
|
||||
Modules can't print to the screen like printf() can, but they can log
|
||||
information and warnings, which ends up being printed on your screen, but
|
||||
only on a console. If you insmod a module from an xterm, the information and
|
||||
warnings will be logged, but only to your log files. You won't see it unless
|
||||
you look through your log files. To have immediate access to this
|
||||
information, do all your work from the console.
|
||||
Modules can't print to the screen like printf() can, but they can log information and warnings, which ends up being printed on your screen, but only on a console. If you insmod a module from an xterm, the information and warnings will be logged, but only to your log files. You won't see it unless you look through your log files. To have immediate access to this information, do all your work from the console.
|
||||
|
||||
**** Compiling Issues and Kernel Version
|
||||
|
||||
Very often, Linux distros will distribute kernel source that has been patched
|
||||
in various non-standard ways, which may cause trouble.
|
||||
Very often, Linux distros will distribute kernel source that has been patched in various non-standard ways, which may cause trouble.
|
||||
|
||||
A more common problem is that some Linux distros distribute incomplete kernel
|
||||
headers. You'll need to compile your code using various header files from the
|
||||
Linux kernel. Murphy's Law states that the headers that are missing are
|
||||
exactly the ones that you'll need for your module work.
|
||||
A more common problem is that some Linux distros distribute incomplete kernel headers. You'll need to compile your code using various header files from the Linux kernel. Murphy's Law states that the headers that are missing are exactly the ones that you'll need for your module work.
|
||||
|
||||
To avoid these two problems, I highly recommend that you download, compile
|
||||
and boot into a fresh, stock Linux kernel which can be downloaded from any of
|
||||
the Linux kernel mirror sites. See the Linux Kernel HOWTO for more details.
|
||||
To avoid these two problems, I highly recommend that you download, compile and boot into a fresh, stock Linux kernel which can be downloaded from any of the Linux kernel mirror sites. See the Linux Kernel HOWTO for more details.
|
||||
|
||||
Ironically, this can also cause a problem. By default, gcc on your system may
|
||||
look for the kernel headers in their default location rather than where you
|
||||
installed the new copy of the kernel (usually in /usr/src/. This can be fixed
|
||||
by using gcc's -I switch.
|
||||
Ironically, this can also cause a problem. By default, gcc on your system may look for the kernel headers in their default location rather than where you installed the new copy of the kernel (usually in /usr/src/. This can be fixed by using gcc's -I switch.
|
||||
|
||||
* Hello World
|
||||
** Hello, World (part 1): The Simplest Module
|
||||
|
||||
Reference in New Issue
Block a user