1.\" $OpenBSD: modload.8,v 1.21 2002/01/09 18:23:31 mpech Exp $ 2.\" $NetBSD: modload.8,v 1.17 2001/11/16 11:57:16 wiz Exp $ 3.\" 4.\" Copyright (c) 1993 Christopher G. Demetriou 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. All advertising materials mentioning features or use of this software 16.\" must display the following acknowledgement: 17.\" This product includes software developed for the 18.\" NetBSD Project. See http://www.netbsd.org/ for 19.\" information about NetBSD. 20.\" 4. The name of the author may not be used to endorse or promote products 21.\" derived from this software without specific prior written permission. 22.\" 23.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33.\" 34.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 35.\" 36.Dd April 30, 1999 37.Dt MODLOAD 8 38.Os 39.Sh NAME 40.Nm modload 41.Nd load a kernel module 42.Sh SYNOPSIS 43.Nm modload 44.Op Fl dnvsS 45.Op Fl A Ar kernel 46.Op Fl e Ar entry 47.Op Fl p Ar postinstall 48.Op Fl o Ar output_file 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 or .ko file). 55.Pp 56The options to 57.Nm 58are as follows: 59.Bl -tag -width Ds 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 71Do not load symbols from the kernel module. 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 90.Sq xxxinit . 91If 92.Sq xxxinit 93cannot be found, an attempt to use 94.Sq <module_name>_lkmentry 95will be made, where <module_name> is the filename being loaded without 96the 97.Sq .o 98or 99.Sq .ko . 100.It Fl p Ar postinstall 101Specify the name of a shell script or program that will 102be executed if the module is successfully loaded. 103It is always passed the module id (in decimal) and module 104type (in hexadecimal) as the first two arguments. 105For loadable drivers, the third argument is 106the block or character major device number. 107For a loadable system call, the third argument is the system 108call number. 109.It Fl o Ar output_file 110Specify the name of the output file that is produced by 111the linker. 112.El 113.Sh FILES 114.Bl -tag -width /usr/include/sys/lkm.h -compact 115.It Pa /bsd 116default file passed to the linker to resolve external 117references in the module 118.It Pa /usr/include/sys/lkm.h 119file containing definitions of module types 120.El 121.Sh DIAGNOSTICS 122The 123.Nm 124utility exits with a status of 0 on success 125and with a nonzero status if an error occurs. 126.Sh SEE ALSO 127.Xr ld 1 , 128.Xr lkm 4 , 129.Xr modstat 8 , 130.Xr modunload 8 131.Sh HISTORY 132The 133.Nm 134command was designed to be similar in functionality 135to the corresponding command in 136.Tn "SunOS 4.1.3" . 137.Sh AUTHORS 138.An Terrence R. Lambert Aq terry@cs.weber.edu 139.Sh BUGS 140.Bl -bullet 141.It 142The loadable device driver framework can 143only reserve either a character or block device entry, not both. 144.It 145Loading the symbol table is expensive in terms of space: 146it presently duplicates all the kernel symbols for each lkm loaded 147with 148.Fl s . 149.El 150