xref: /freebsd/sbin/kldload/kldload.8 (revision 64db9a0f82863d212ac0bcd49bc0254ccb9dd1ac)
1a79fe607SDoug Rabson.\"
2a79fe607SDoug Rabson.\" Copyright (c) 1997 Doug Rabson
3a79fe607SDoug Rabson.\" All rights reserved.
4a79fe607SDoug Rabson.\"
5a79fe607SDoug Rabson.\" Redistribution and use in source and binary forms, with or without
6a79fe607SDoug Rabson.\" modification, are permitted provided that the following conditions
7a79fe607SDoug Rabson.\" are met:
8a79fe607SDoug Rabson.\" 1. Redistributions of source code must retain the above copyright
9a79fe607SDoug Rabson.\"    notice, this list of conditions and the following disclaimer.
10a79fe607SDoug Rabson.\" 2. Redistributions in binary form must reproduce the above copyright
11a79fe607SDoug Rabson.\"    notice, this list of conditions and the following disclaimer in the
12a79fe607SDoug Rabson.\"    documentation and/or other materials provided with the distribution.
13a79fe607SDoug Rabson.\"
14a79fe607SDoug Rabson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15a79fe607SDoug Rabson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16a79fe607SDoug Rabson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17a79fe607SDoug Rabson.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18a79fe607SDoug Rabson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19a79fe607SDoug Rabson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20a79fe607SDoug Rabson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21a79fe607SDoug Rabson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22a79fe607SDoug Rabson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23a79fe607SDoug Rabson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24a79fe607SDoug Rabson.\" SUCH DAMAGE.
25a79fe607SDoug Rabson.\"
26*64db9a0fSWarner Losh.Dd December 20, 2023
27a79fe607SDoug Rabson.Dt KLDLOAD 8
289fe48c6eSRuslan Ermilov.Os
29a79fe607SDoug Rabson.Sh NAME
30a79fe607SDoug Rabson.Nm kldload
31a79fe607SDoug Rabson.Nd load a file into the kernel
32a79fe607SDoug Rabson.Sh SYNOPSIS
337c7fb079SRuslan Ermilov.Nm
3456d3acc1SHans Petter Selasky.Op Fl nqv
3594c61219SJuli Mallett.Ar
36a79fe607SDoug Rabson.Sh DESCRIPTION
37a79fe607SDoug RabsonThe
38a79fe607SDoug Rabson.Nm
3994c61219SJuli Mallettutility loads
4094c61219SJuli Mallett.Ar file Ns Pa .ko
41a87c2a93SDavid E. O'Brieninto the kernel using the kernel linker.
4294c61219SJuli MallettNote that if multiple modules are specified then an attempt will
4394c61219SJuli Mallettbe made to load them all, even if some fail.
44fc3643bbSGiorgos KeramidasThe
45fc3643bbSGiorgos Keramidas.Pa .ko
46fc3643bbSGiorgos Keramidasextension name is not mandatory when loading a given module
47fc3643bbSGiorgos Keramidasusing
48fc3643bbSGiorgos Keramidas.Nm .
494e9e907dSRuslan ErmilovIt does not hurt to specify it though.
50a79fe607SDoug Rabson.Pp
5102479eadSBenno RiceIf a bare filename is requested it will only be loaded if it is found within
5202479eadSBenno Ricethe module path as defined by the sysctl
5302479eadSBenno Rice.Va kern.module_path .
5402479eadSBenno RiceTo load a module from the current directory it must be specified as a full or
5502479eadSBenno Ricerelative path.
5602479eadSBenno RiceThe
5702479eadSBenno Rice.Nm
5802479eadSBenno Riceutility will warn if a module is requested as a bare filename and is present
5902479eadSBenno Ricein the current directory.
6002479eadSBenno Rice.Pp
61d7e1af0aSMaxim KonovalovThe following options are available:
6249fea209SPhilippe Charnier.Bl -tag -width indent
6356d3acc1SHans Petter Selasky.It Fl n
64b1edef17SJoel DahlDo not try to load module if already loaded.
65a79fe607SDoug Rabson.It Fl v
66a79fe607SDoug RabsonBe more verbose.
6702479eadSBenno Rice.It Fl q
6802479eadSBenno RiceSilence any extraneous warnings.
69a79fe607SDoug Rabson.El
7066a9ad5dSXin LI.Sh NOTES
7166a9ad5dSXin LIThe kernel security level settings may prevent a module from being
7266a9ad5dSXin LIloaded or unloaded by giving
7366a9ad5dSXin LI.Em "Operation not permitted" .
74a87c2a93SDavid E. O'Brien.Sh FILES
75b1d5d887SAndrey A. Chernov.Bl -tag -width /boot/kernel -compact
76b1d5d887SAndrey A. Chernov.It Pa /boot/kernel
775bfebe7bSRuslan Ermilovdirectory containing loadable modules.
785bfebe7bSRuslan ErmilovModules must have an extension of
795bfebe7bSRuslan Ermilov.Pa .ko .
801252c1bbSRuslan Ermilov.El
81a866e170SRuslan Ermilov.Sh EXIT STATUS
821f78c0cbSRuslan Ermilov.Ex -std
8302479eadSBenno Rice.Sh EXAMPLES
8402479eadSBenno RiceTo load by module name:
8502479eadSBenno Rice.Bd -literal -offset indent
8602479eadSBenno Rice\*[Gt] kldload foo
8702479eadSBenno Rice.Ed
8802479eadSBenno Rice.Pp
8902479eadSBenno RiceTo load by file name within the module path:
9002479eadSBenno Rice.Bd -literal -offset indent
9102479eadSBenno Rice\*[Gt] kldload foo.ko
9202479eadSBenno Rice.Ed
9302479eadSBenno Rice.Pp
9402479eadSBenno RiceTo load by relative path:
9502479eadSBenno Rice.Bd -literal -offset indent
9602479eadSBenno Rice\*[Gt] kldload ./foo.ko
9702479eadSBenno Rice.Ed
9802479eadSBenno Rice.Pp
9902479eadSBenno RiceTo load by full path:
10002479eadSBenno Rice.Bd -literal -offset indent
10102479eadSBenno Rice\*[Gt] kldload /boot/kernel/foo.ko
10202479eadSBenno Rice.Ed
10345943e22SMike Silbersack.Sh AUTOMATICALLY LOADING MODULES
10465fe4c0bSTom RhodesSome modules (pf, ipfw, ipf, etc.) may be automatically loaded at boot
105fc3643bbSGiorgos Keramidastime when the corresponding
106fc3643bbSGiorgos Keramidas.Xr rc.conf 5
107fc3643bbSGiorgos Keramidasstatement is used.
10845943e22SMike SilbersackModules may also be auto-loaded through their addition to
109866c8b8dSDaniel Ebdrup Jensen.Xr loader.conf 5
110866c8b8dSDaniel Ebdrup Jensenor kld_list in
111866c8b8dSDaniel Ebdrup Jensen.Xr rc.conf 5 .
112866c8b8dSDaniel Ebdrup Jensen.Pp
1132a7d4d95SDaniel Ebdrup JensenOnly those modules necessary for booting the system, including those
1142a7d4d95SDaniel Ebdrup Jensenrequired for mounting the root filesystem, should be handled by
11545943e22SMike Silbersack.Xr loader.conf 5 .
116a79fe607SDoug Rabson.Sh SEE ALSO
117*64db9a0fSWarner Losh.Xr kenv 1 ,
118fa8b1c61SChris Costello.Xr kldload 2 ,
11945943e22SMike Silbersack.Xr loader.conf 5 ,
1201f78c0cbSRuslan Ermilov.Xr rc.conf 5 ,
12166a9ad5dSXin LI.Xr security 7 ,
122bdb963f9SRuslan Ermilov.Xr kldconfig 8 ,
1231f78c0cbSRuslan Ermilov.Xr kldstat 8 ,
124461ef81dSEdward Tomasz Napierala.Xr kldunload 8 ,
125461ef81dSEdward Tomasz Napierala.Xr kldxref 8
1262830148aSJohn-Mark Gurney.Sh HISTORY
1272830148aSJohn-Mark GurneyThe
1282830148aSJohn-Mark Gurney.Nm
129e1205e80SPhilippe Charnierutility first appeared in
130a87c2a93SDavid E. O'Brien.Fx 3.0 ,
131a87c2a93SDavid E. O'Brienreplacing the
1325ab2dec3SChristian Brueffer.Nm lkm
133a87c2a93SDavid E. O'Brieninterface.
13468085a0eSPhilippe Charnier.Sh AUTHORS
135bd0891ceSBaptiste Daroussin.An Doug Rabson Aq Mt dfr@FreeBSD.org
136