xref: /freebsd/sbin/kldconfig/kldconfig.8 (revision e5b786625f7f82a1fa91e41823332459ea5550f9)
1.\"
2.\" Copyright (c) 2001 Peter Pentchev
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd September 29, 2020
27.Dt KLDCONFIG 8
28.Os
29.Sh NAME
30.Nm kldconfig
31.Nd display or modify the kernel module search path
32.Sh SYNOPSIS
33.Nm
34.Op Fl dfimnUv
35.Op Fl S Ar sysctlname
36.Op Ar path ...
37.Nm
38.Fl r
39.Sh DESCRIPTION
40The
41.Nm
42utility
43displays or modifies the search path used by the kernel when loading modules
44using the
45.Xr kldload 8
46utility or the
47.Xr kldload 2
48syscall.
49.Pp
50The following options are available:
51.Bl -tag -width indent
52.It Fl d
53Remove the specified paths from the module search path.
54.It Fl f
55Do not fail if a path specified for adding is already present in the search
56path, or if a path specified for removing is not present in the search path.
57This may be useful in startup/shutdown scripts for adding a path to
58a file system which is still not mounted, or in shutdown scripts for
59unconditionally removing a path that may have been added during startup.
60.It Fl i
61Add the specified paths to the beginning of the search path, not to the end.
62This option can only be used when adding paths.
63.It Fl m
64Instead of replacing the module search path with the set of paths
65specified,
66.Dq merge
67in the new entries.
68.It Fl n
69Do not actually change the module search path.
70.It Fl r
71Display the current search path.
72This option cannot be used if any paths are also specified.
73.It Fl S Ar sysctlname
74Specify the sysctl name to use instead of the default
75.Va kern.module_path .
76.It Fl U
77.Dq Unique-ify
78the current search path - if any of the directories is repeated one
79or more times, only the first occurrence remains.
80This option implies
81.Fl m .
82.It Fl v
83Verbose output: display the new module search path.
84If the path has been changed, and the
85.Fl v
86flag is specified more than once, the old path is displayed as well.
87.El
88.Sh FILES
89.Bl -tag -width indent
90.It Pa /boot/kernel , /boot/modules , /modules
91The default module search path used by the kernel.
92.El
93.Sh EXIT STATUS
94.Ex -std
95.Sh EXAMPLES
96Show the module search path
97.Bd -literal -offset indent
98$ kldconfig -r
99/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays
100.Ed
101.Pp
102Try to delete the
103.Pa /boot
104directory from the search path.
105The command will fail:
106.Bd -literal -offset indent
107$ kldconfig -d /boot
108kldconfig: not in module search path: /boot
109$ echo $?
1101
111.Ed
112.Pp
113Same as above but forcing the operation.
114This time the command will succeed:
115.Bd -literal -offset indent
116$ kldconfig -d -f /boot
117$ echo $?
1180
119.Ed
120.Pp
121Add the
122.Pa /boot
123directory to the beginning of the search path and display extra verbose output:
124.Bd -literal -offset indent
125$ kldconfig -i -m -vv /boot
126/boot/kernel;/boot/modules -> /boot;/boot/kernel;/boot/modules
127.Ed
128.Pp
129Without
130.Fl m
131the
132.Fl i
133flag will overwrite the contents of the search path list:
134.Bd -literal -offset indent
135$ kldconfig -i -vv /boot
136/boot;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays -> /boot
137.Ed
138.Pp
139Same as above but using
140.Fl n
141to simulate the operation without actually doing it:
142.Bd -literal -offset indent
143$ kldconfig -i -n -vv /boot
144/boot;/boot/kernel;/boot/modules;/boot/dtb;/boot/dtb/overlays -> /boot
145.Ed
146.Pp
147Add directories to the search path removing duplicates.
148Note the need of
149.Fl f
150to force the operation in case any of the directories is already in the
151search path.
152The
153.Pa /boot/kernel
154directory will be added once:
155.Bd -literal -offset indent
156$ kldconfig -f -U /boot/kernel /boot/kernel /boot/modules /boot/dtb /boot/dtb/overlays
157.Ed
158.Sh SEE ALSO
159.Xr kldload 2 ,
160.Xr kldload 8 ,
161.Xr kldxref 8 ,
162.Xr sysctl 8
163.Sh HISTORY
164The
165.Nm
166utility first appeared in
167.Fx 4.4 .
168.Sh AUTHORS
169.An Peter Pentchev Aq Mt roam@FreeBSD.org
170