1.\" $NetBSD: modload.8,v 1.18 2002/02/08 01:30:44 ross 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.Ar input_file 49.Sh DESCRIPTION 50The 51.Nm 52utility loads a loadable kernel module into a running system. 53The input file is an object file (.o file). 54.Pp 55The options to 56.Nm 57are as follows: 58.Bl -tag -width indent 59.It Fl d 60Debug. Used to debug 61.Nm 62itself. 63.It Fl n 64Do everything, except calling the module entry point (and any 65post-install program). 66.It Fl v 67Print comments about the loading process. 68.It Fl s 69Load the symbol table. 70.It Fl S 71Do not remove the temporary object file. By default, the 72.Xr ld 1 73output is removed after being loaded into the kernel. 74.It Fl A Ar kernel 75Specify the file that is passed to the linker 76to resolve module references to external symbols. 77The symbol file must be for the currently running 78kernel or the module is likely to crash the system. 79.It Fl e Ar entry 80Specify the module entry point. 81This is passed by 82.Nm 83to 84.Xr ld 1 85when the module is linked. 86The default module entry point name is `xxxinit'. If `xxxinit' cannot be 87found, an attempt to use `\*[Lt]module_name\*[Gt]_lkmentry' will be made, where 88\*[Lt]module_name\*[Gt] is the filename being loaded without the `.o'. 89.It Fl p Ar postinstall 90Specify the name of a shell script or program that will 91be executed if the module is successfully loaded. It 92is always passed the module id (in decimal) and module 93type (in hexadecimal) as the first two arguments. 94For loadable drivers, the third argument is 95the block or character major device number. 96For a loadable system call, the third argument is the system 97call number. 98.It Fl o Ar output_file 99Specify the name of the output file that is produced by 100the linker. 101.El 102.Sh FILES 103.Bl -tag -width /usr/include/sys/lkm.h -compact 104.It Pa /netbsd 105default file passed to the linker to resolve external 106references in the module 107.It Pa /usr/include/sys/lkm.h 108file containing definitions of module types 109.\" .It Pa output file. 110.\" default output file name 111.El 112.Sh DIAGNOSTICS 113The 114.Nm 115utility exits with a status of 0 on success 116and with a nonzero status if an error occurs. 117.Sh SEE ALSO 118.Xr ld 1 , 119.Xr lkm 4 , 120.Xr modstat 8 , 121.Xr modunload 8 122.Sh HISTORY 123The 124.Nm 125command was designed to be similar in functionality 126to the corresponding command in 127.Tn "SunOS 4.1.3" . 128.Sh AUTHORS 129.An Terrence R. Lambert Aq terry@cs.weber.edu 130.Sh BUGS 131.Bl -bullet 132.It 133The loadable device driver framework can 134only reserve either a character or block device entry, not both. 135.It 136Loading the symbol table is expensive in terms of space: 137it presently duplicates all the kernel symbols for each lkm loaded 138with 139.Fl s . 140.El 141