]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/kenv/kenv.1
pwait.1: add missing prompt and command in examples
[FreeBSD/FreeBSD.git] / bin / kenv / kenv.1
1 .\"-
2 .\" Copyright (c) 2000  Peter Wemm <peter@FreeBSD.org>
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .Dd June 20, 2021
26 .Dt KENV 1
27 .Os
28 .Sh NAME
29 .Nm kenv
30 .Nd list or modify the kernel environment
31 .Sh SYNOPSIS
32 .Nm
33 .Op Fl l | s
34 .Op Fl hNq
35 .Nm
36 .Op Fl qv
37 .Ar variable Ns Op = Ns Ar value
38 .Nm
39 .Op Fl q
40 .Fl u
41 .Ar variable
42 .Sh DESCRIPTION
43 The
44 .Nm
45 utility will list all variables in the kernel environment if
46 invoked without arguments.
47 .Pp
48 If the
49 .Fl l
50 option is specified, then the static environment provided by
51 .Xr loader 8
52 will be listed instead.
53 Similarly, the
54 .Fl s
55 option will list the static environment defined by the kernel config.
56 Both of the
57 .Fl l
58 and
59 .Fl s
60 options are dependent on the kernel being configured to preserve early kernel
61 environments.
62 The default kernel configuration does not preserve these environments.
63 .Pp
64 If the
65 .Fl h
66 option is specified, it will limit the report to kernel probe hints.
67 If an optional
68 .Ar variable
69 name is specified,
70 .Nm
71 will only report that value.
72 If the
73 .Fl N
74 option is specified,
75 .Nm
76 will only display variable names and not their values.
77 If the
78 .Fl u
79 option is specified,
80 .Nm
81 will delete the given environment variable.
82 If the environment variable is followed by an optional
83 .Ar value ,
84 .Nm
85 will set the environment variable to this value.
86 .Pp
87 If the
88 .Fl q
89 option is set, warnings normally printed as a result of being unable to
90 perform the requested operation will be suppressed.
91 .Pp
92 If the
93 .Fl v
94 option is set, the variable name will be printed out for the
95 environment variable in addition to the value when
96 .Nm
97 is executed with a variable name.
98 .Pp
99 Variables can be added to the kernel environment using the
100 .Pa /boot/loader.conf
101 file, or also statically compiled into the kernel using the statement
102 .Pp
103 .Dl Ic env Ar filename
104 .Pp
105 in the kernel config file.
106 The file can contain lines of the form
107 .Pp
108 .Dl name = "value"  # this is a comment
109 .Pp
110 where whitespace around
111 .Sq name
112 and
113 .Sq = ,
114 and everything after a
115 .Sq #
116 character, are ignored.
117 Almost any printable character except
118 .Sq =
119 is acceptable as part of a name.
120 Quotes are optional and necessary only if the value contains whitespace.
121 .Sh EXAMPLES
122 Show kernel probe hints variable names and filter for the uart
123 device
124 .Bd -literal -offset indent
125 $ kenv -h -N | grep uart
126 hint.uart.0.at
127 hint.uart.0.flags
128 hint.uart.0.irq
129 hint.uart.0.port
130 hint.uart.1.at
131 hint.uart.1.irq
132 hint.uart.1.port
133 .Ed
134 .Pp
135 Show the value of a specific variable:
136 .Bd -literal -offset indent
137 $ kenv hint.uart.1.at
138 isa
139 .Ed
140 .Pp
141 Same as above but adding the name of the variable in the report:
142 .Bd -literal -offset indent
143 $ kenv -v hint.uart.1.at
144 hint.uart.1.at="isa"
145 .Ed
146 .Pp
147 Try to delete a variable and suppress warnings if any:
148 .Bd -literal -offset indent
149 $ kenv -q -u hint.uart.1.at
150 .Ed
151 .Pp
152 Set the value of the
153 .Ev verbose_loading
154 variable
155 .Bd -literal -offset indent
156 $ kenv verbose_loading="YES"
157 verbose_loading="YES"
158 .Ed
159 .Sh SEE ALSO
160 .Xr kenv 2 ,
161 .Xr config 5 ,
162 .Xr loader.conf 5 ,
163 .Xr loader 8
164 .Sh HISTORY
165 The
166 .Nm
167 utility appeared in
168 .Fx 4.1.1 .