xref: /netbsd/sbin/modload/modload.8 (revision c4a72b64)
1.\" $NetBSD: modload.8,v 1.21 2002/10/10 01:57:10 simonb Exp $
2.\"
3.\" Copyright (c) 1993 Christopher G. Demetriou
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"          This product includes software developed for the
17.\"          NetBSD Project.  See http://www.netbsd.org/ for
18.\"          information about NetBSD.
19.\" 4. The name of the author may not be used to endorse or promote products
20.\"    derived from this software without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32.\"
33.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
34.\"
35.Dd April 30, 1999
36.Dt MODLOAD 8
37.Os
38.Sh NAME
39.Nm modload
40.Nd load a kernel module
41.Sh SYNOPSIS
42.Nm ""
43.Op Fl dnvsS
44.Op Fl A Ar kernel
45.Op Fl e Ar entry
46.Op Fl p Ar postinstall
47.Op Fl o Ar output_file
48.Op Fl T Ar linker_script
49.Ar input_file
50.Sh DESCRIPTION
51The
52.Nm
53utility loads a loadable kernel module into a running system.
54The input file is an object file (.o file).
55.Pp
56The options to
57.Nm
58are as follows:
59.Bl -tag -width indent
60.It Fl d
61Debug.
62Used to debug
63.Nm
64itself.
65.It Fl n
66Do everything, except calling the module entry point (and any
67post-install program).
68.It Fl v
69Print comments about the loading process.
70.It Fl s
71Load the symbol table.
72.It Fl S
73Do not remove the temporary object file.
74By default, the
75.Xr ld 1
76output is removed after being loaded into the kernel.
77.It Fl A Ar kernel
78Specify the file that is passed to the linker
79to resolve module references to external symbols.
80The symbol file must be for the currently running
81kernel or the module is likely to crash the system.
82.It Fl e Ar entry
83Specify the module entry point.
84This is passed by
85.Nm
86to
87.Xr ld 1
88when the module is linked.
89The default module entry point name is `xxxinit'.
90If `xxxinit' cannot be found, an attempt to
91use `\*[Lt]module_name\*[Gt]_lkmentry' will be made, where
92\*[Lt]module_name\*[Gt] is the filename being loaded without the `.o'.
93.It Fl p Ar postinstall
94Specify the name of a shell script or program that will
95be executed if the module is successfully loaded.
96It is always passed the module id (in decimal) and module
97type (in hexadecimal) as the first two arguments.
98For loadable drivers, the third argument is the character major device number
99and the fourth argument is the block major device number.
100For a loadable system call, the third argument is the system call number.
101.It Fl o Ar output_file
102Specify the name of the output file that is produced by the linker.
103.It Fl T Ar linker_script
104Specify the name of the linker script use to link against the kernel.
105.El
106.Sh FILES
107.Bl -tag -width /usr/include/sys/lkm.h -compact
108.It Pa /netbsd
109default file passed to the linker to resolve external
110references in the module
111.It Pa /usr/include/sys/lkm.h
112file containing definitions of module types
113.\" .It Pa output file.
114.\" default output file name
115.El
116.Sh DIAGNOSTICS
117The
118.Nm
119utility exits with a status of 0 on success
120and with a nonzero status if an error occurs.
121.Sh SEE ALSO
122.Xr ld 1 ,
123.Xr lkm 4 ,
124.Xr modstat 8 ,
125.Xr modunload 8
126.Sh HISTORY
127The
128.Nm
129command was designed to be similar in functionality
130to the corresponding command in
131.Tn "SunOS 4.1.3" .
132.Sh AUTHORS
133.An Terrence R. Lambert Aq terry@cs.weber.edu
134.Sh BUGS
135Loading the symbol table is expensive in terms of space:
136it presently duplicates all the kernel symbols for each lkm loaded
137with
138.Fl s .
139