1.\" $NetBSD: modload.8,v 1.26 2006/03/24 00:38:23 reed 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 March 23, 2006 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 dfnsSv 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 f 66This forces load of the module, even if it doesn't match the 67currently running kernel. 68When LKM is loaded, the kernel normally checks if the LKM is 69compatible with the running kernel. 70This option disables this check. 71.Em Note 72an incompatible LKM can cause system instability, including data 73loss or corruption. 74Don't use this option unless you are sure what you are doing. 75.It Fl n 76Do everything, except calling the module entry point (and any 77post-install program). 78.It Fl v 79Print comments about the loading process. 80.It Fl s 81Load the symbol table. 82.It Fl S 83Do not remove the temporary object file. 84By default, the 85.Xr ld 1 86output is removed after being loaded into the kernel. 87.It Fl A Ar kernel 88Specify the file that is passed to the linker 89to resolve module references to external symbols. 90The symbol file must be for the currently running 91kernel or the module is likely to crash the system. 92.It Fl e Ar entry 93Specify the module entry point. 94This is passed by 95.Nm 96to 97.Xr ld 1 98when the module is linked. 99The default module entry point name is `xxxinit'. 100If `xxxinit' cannot be found, an attempt to 101use `\*[Lt]module_name\*[Gt]_lkmentry' will be made, where 102\*[Lt]module_name\*[Gt] is the filename being loaded without the `.o'. 103.It Fl p Ar postinstall 104Specify the name of a shell script or program that will 105be executed if the module is successfully loaded. 106It is always passed the module id (in decimal) and module 107type (in hexadecimal) as the first two arguments. 108For loadable drivers, the third argument is the character major device number 109and the fourth argument is the block major device number. 110For a loadable system call, the third argument is the system call number. 111.It Fl o Ar output_file 112Specify the name of the output file that is produced by the linker. 113.It Fl T Ar linker_script 114Specify the name of the linker script use to link against the kernel. 115.El 116.Sh FILES 117.Bl -tag -width /usr/include/sys/lkm.h -compact 118.It Pa /netbsd 119default file passed to the linker to resolve external 120references in the module 121.It Pa /usr/include/sys/lkm.h 122file containing definitions of module types 123.\" .It Pa output file. 124.\" default output file name 125.El 126.Sh DIAGNOSTICS 127The 128.Nm 129utility exits with a status of 0 on success 130and with a nonzero status if an error occurs. 131.Pp 132Mismatched LKM and kernel versions will be reported to the console 133and to the system message buffer. 134.Sh SEE ALSO 135.Xr ld 1 , 136.Xr lkm 4 , 137.Xr modstat 8 , 138.Xr modunload 8 139.Sh HISTORY 140The 141.Nm 142command was designed to be similar in functionality 143to the corresponding command in 144.Tn "SunOS 4.1.3" . 145.Sh AUTHORS 146.An Terrence R. Lambert 147.Aq terry@cs.weber.edu . 148.Sh BUGS 149Loading the symbol table is expensive in terms of space: 150it presently duplicates all the kernel symbols for each lkm loaded 151with 152.Fl s . 153