Linux Kernel Architecture

(Jacob Rumans) #1

Chapter7:Modules


❑ Configuration parameters that can be passed to the module; possibly with a description of the
exact meaning of the parameters.
❑ The designation of the device supported (e.g.,fdfor floppy disk).
❑ The license under which the module is distributed.

A separate list is also provided in the module information to accept a list of different device types
supported by the driver.

Querying module information using themodinfotool is not difficult, as the following example shows:

wolfgang@meitner>/sbin/modinfo 8139too
filename: /lib/modules/2.6.24/kernel/drivers/net/8139too.ko
version: 0.9.28
license: GPL
description: RealTek RTL-8139 Fast Ethernet driver
author: Jeff Garzik [email protected]
srcversion: 1D03CC1F1622811EB8ACD9E
alias: pci:vd00008139sv000013D1sd0000AB06bcsci
...
alias: pci:v000010ECd00008139svsdbcsci*
depends:
vermagic: 2.6.24 SMP mod_unload
parm: debug:8139too bitmapped message enable number (int)
parm: multicast_filter_limit:8139too maximum number of filtered multicast addresses
(int)
parm: media:8139too: Bits 4+9: force full duplex, bit 5: 100Mbps (array of int)
parm: full_duplex:8139too: Force full duplex for board(s) (1) (array of int)


The kernel does not demand that developers supply this information in every module, although this is
good programming practice and should be done for new drivers. Many older modules do not provide
all the above fields, and developers are generally quite happy to omit detailed descriptions of possible
parameters. However, in most cases, there is at least a brief description, the name of the (main) author,
and a note on the software license under which the driver is distributed.

How can this additional information be incorporated in the binary module file? In all binary files that
use the ELF format (see Appendix E), there are various units that organize the binary data into different
categories — technically these are known assections. To allow information on the module to be added,
the kernel introduces a further section named.modinfo. As you will see below, this process is relatively
transparent to the module programmer because a set of simple macros is provided to insert the data into
the binary file. Naturally, the presence of this additional information does not change the behavior of
the code because the.modinfosections are ignored by all programs that handle modules but are not
interested in the information.

Why is information on the module license used stored in the binary file? The reason is not (unfortunately)
a technical one but is of a legal nature. Because the kernel source code is covered by the GNU GPL license,
there are several legal problems surrounding the use of modules distributed in binary code only. In this
respect, the GPL license is somewhat difficult to interpret.^8 For this reason, I do not intend to deal with
the legal implications here — this is best left to the legal departments of large software manufacturers. It
is enough to know that such modules may use only the kernel functions explicitly provided (in contrast,
there are also functions that are explicitly providedfor GPL-compatible modules only). The standard set

(^8) Some programmers suggest that there are more interpretations of GPL than there are programs distributed under the license.

Free download pdf