Commit 8048a09d authored by Sam Ravnborg's avatar Sam Ravnborg

Documentation/modules.txt: How to compile modules outside the kernel tree

Updated documentation/modules.txt with the following:
o Default config target is menuconfig
o Documented INSTLL_MOD_PATH
o Referenced to kernel 2.4
o How to compile modules outside the kernel tree

There is a lot of stuff in need for updating, this is first step
parent 041e6a1f
...@@ -9,20 +9,13 @@ modules packages aren't aware of some of the newer modular features ...@@ -9,20 +9,13 @@ modules packages aren't aware of some of the newer modular features
that the kernel now supports. The current required version is listed that the kernel now supports. The current required version is listed
in the file linux/Documentation/Changes. in the file linux/Documentation/Changes.
* * * NOTE * * *
The kernel has been changed to remove kerneld support and use
the new kmod support. Keep this in mind when reading this file. Kmod
does the exact same thing as kerneld, but doesn't require an external
program (see Documentation/kmod.txt)
In the beginning... In the beginning...
------------------- -------------------
Anyway, your first step is to compile the kernel, as explained in the Anyway, your first step is to compile the kernel, as explained in the
file linux/README. It generally goes like: file linux/README. It generally goes like:
make config make *config <= usually menuconfig or xconfig
make dep
make clean make clean
make zImage or make zlilo make zImage or make zlilo
...@@ -39,15 +32,16 @@ You will generally select the minimal resident set that is needed to boot: ...@@ -39,15 +32,16 @@ You will generally select the minimal resident set that is needed to boot:
plus those things that you just can't live without... plus those things that you just can't live without...
The set of modules is constantly increasing, and you will be able to select The set of modules is constantly increasing, and you will be able to select
the option "m" in "make config" for those features that the current kernel the option "m" in "make menuconfig" for those features that the current kernel
can offer as loadable modules. can offer as loadable modules.
You also have a possibility to create modules that are less dependent on You also have a possibility to create modules that are less dependent on
the kernel version. This option can be selected during "make config", by the kernel version. This option can be selected during "make *config", by
enabling CONFIG_MODVERSIONS, and is most useful on "stable" kernel versions, enabling CONFIG_MODVERSIONS, and is most useful on "stable" kernel versions,
such as the kernels from the 1.2 and 2.0 series. such as the kernels from the 2.<even number> series.
If you have modules that are based on sources that are not included in If you have modules that are based on sources that are not included in
the official kernel sources, you will certainly like this option... the official kernel sources, you will certainly like this option...
See below how to compile modules outside the official kernel.
Here is a sample of the available modules included in the kernel sources: Here is a sample of the available modules included in the kernel sources:
...@@ -83,22 +77,45 @@ When you have made the kernel, you create the modules by doing: ...@@ -83,22 +77,45 @@ When you have made the kernel, you create the modules by doing:
make modules make modules
This will compile all modules and update the linux/modules directory. This will compile all modules. A module is identified by the
In this directory you will then find a bunch of symbolic links, extension .ko, for kernel object.
pointing to the various object files in the kernel tree.
Now, after you have created all your modules, you should also do: Now, after you have created all your modules, you should also do:
make modules_install make modules_install
This will copy all newly made modules into subdirectories under This will copy all newly made modules into subdirectories under
"/lib/modules/kernel_release/", where "kernel_release" is something "/lib/modules/kernel_release/", where "kernel_release" is something
like 2.0.1, or whatever the current kernel version is... like 2.5.54, or whatever the current kernel version is.
Note: Installing modules may require root privileges.
As soon as you have rebooted the newly made kernel, you can install As soon as you have rebooted the newly made kernel, you can install
and remove modules at will with the utilities: "insmod" and "rmmod". and remove modules at will with the utilities: "insmod" and "rmmod".
After reading the man-page for insmod, you will also know how easy After reading the man-page for insmod, you will also know how easy
it is to configure a module when you do "insmod" (hint: symbol=value). it is to configure a module when you do "insmod" (hint: symbol=value).
Installing modules in a non-standard location
---------------------------------------------
When the modules needs to be installed under another directory
the INSTALL_MOD_PATH can be used to prefix "/lib/modules" as seen
in the following example:
make INSTALL_MOD_PATH=/frodo modules_install
This will install the modules in the directory /frodo/lib/modules.
/frodo can be a NFS mounted filesystem on another machine, allowing
out-of-the-box support for installation on remote machines.
Compiling modules outside the official kernel
---------------------------------------------
Often modules are developed outside the official kernel.
To keep up with changes in the build system the most portable way
to compile a module outside the kernel is to use the following command-line:
make -C path/to/kernel/src SUBDIRS=$PWD modules
This requires that a makefile exits made in accordance to
Documentation/kbuild/makefiles.txt.
Nifty features: Nifty features:
--------------- ---------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment