19ddb49cbSWarner Losh.\"- 2c5e7e03aSRuslan Ermilov.\" Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> 3c87a63c1SPeter Wemm.\" 4c87a63c1SPeter Wemm.\" Redistribution and use in source and binary forms, with or without 5c87a63c1SPeter Wemm.\" modification, are permitted provided that the following conditions 6c87a63c1SPeter Wemm.\" are met: 7c87a63c1SPeter Wemm.\" 1. Redistributions of source code must retain the above copyright 8c87a63c1SPeter Wemm.\" notice, this list of conditions and the following disclaimer. 9c87a63c1SPeter Wemm.\" 2. Redistributions in binary form must reproduce the above copyright 10c87a63c1SPeter Wemm.\" notice, this list of conditions and the following disclaimer in the 11c87a63c1SPeter Wemm.\" documentation and/or other materials provided with the distribution. 12c87a63c1SPeter Wemm.\" 13c87a63c1SPeter Wemm.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 14c87a63c1SPeter Wemm.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15c87a63c1SPeter Wemm.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16c87a63c1SPeter Wemm.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 17c87a63c1SPeter Wemm.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18c87a63c1SPeter Wemm.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19c87a63c1SPeter Wemm.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20c87a63c1SPeter Wemm.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21c87a63c1SPeter Wemm.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22c87a63c1SPeter Wemm.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23c87a63c1SPeter Wemm.\" SUCH DAMAGE. 24c87a63c1SPeter Wemm.\" 2546438b53SKyle Evans.Dd June 20, 2021 26c87a63c1SPeter Wemm.Dt KENV 1 2762500372SRuslan Ermilov.Os 28c87a63c1SPeter Wemm.Sh NAME 29c87a63c1SPeter Wemm.Nm kenv 3046438b53SKyle Evans.Nd list or modify the kernel environment 31c87a63c1SPeter Wemm.Sh SYNOPSIS 328fe908efSRuslan Ermilov.Nm 33*db0f2643SKyle Evans.Op Fl l | s 34af68c71aSMatthew D Fleming.Op Fl hNq 3541196280SMaxime Henrion.Nm 36af68c71aSMatthew D Fleming.Op Fl qv 3741196280SMaxime Henrion.Ar variable Ns Op = Ns Ar value 3841196280SMaxime Henrion.Nm 39af2b8e58SRobert Watson.Op Fl q 4041196280SMaxime Henrion.Fl u 4141196280SMaxime Henrion.Ar variable 42c87a63c1SPeter Wemm.Sh DESCRIPTION 43db1909f7SRuslan ErmilovThe 448fe908efSRuslan Ermilov.Nm 4546438b53SKyle Evansutility will list all variables in the kernel environment if 4641196280SMaxime Henrioninvoked without arguments. 47*db0f2643SKyle Evans.Pp 48*db0f2643SKyle EvansIf the 49*db0f2643SKyle Evans.Fl l 50*db0f2643SKyle Evansoption is specified, then the static environment provided by 51*db0f2643SKyle Evans.Xr loader 8 52*db0f2643SKyle Evanswill be listed instead. 53*db0f2643SKyle EvansSimilarly, the 54*db0f2643SKyle Evans.Fl s 55*db0f2643SKyle Evansoption will list the static environment defined by the kernel config. 56*db0f2643SKyle EvansBoth of the 57*db0f2643SKyle Evans.Fl l 58*db0f2643SKyle Evansand 59*db0f2643SKyle Evans.Fl s 60*db0f2643SKyle Evansoptions are dependent on the kernel being configured to preserve early kernel 61*db0f2643SKyle Evansenvironments. 62*db0f2643SKyle EvansThe default kernel configuration does not preserve these environments. 63*db0f2643SKyle Evans.Pp 64c87a63c1SPeter WemmIf the 65c87a63c1SPeter Wemm.Fl h 66db1909f7SRuslan Ermilovoption is specified, it will limit the report to kernel probe hints. 67db1909f7SRuslan ErmilovIf an optional 68db1909f7SRuslan Ermilov.Ar variable 69db1909f7SRuslan Ermilovname is specified, 70c87a63c1SPeter Wemm.Nm 71c87a63c1SPeter Wemmwill only report that value. 7241196280SMaxime HenrionIf the 73af68c71aSMatthew D Fleming.Fl N 74af68c71aSMatthew D Flemingoption is specified, 75af68c71aSMatthew D Fleming.Nm 76af68c71aSMatthew D Flemingwill only display variable names and not their values. 77af68c71aSMatthew D FlemingIf the 7841196280SMaxime Henrion.Fl u 7941196280SMaxime Henrionoption is specified, 8041196280SMaxime Henrion.Nm 8141196280SMaxime Henrionwill delete the given environment variable. 8241196280SMaxime HenrionIf the environment variable is followed by an optional 832d341e5cSRuslan Ermilov.Ar value , 8441196280SMaxime Henrion.Nm 8541196280SMaxime Henrionwill set the environment variable to this value. 86af2b8e58SRobert Watson.Pp 87af2b8e58SRobert WatsonIf the 88af2b8e58SRobert Watson.Fl q 89af2b8e58SRobert Watsonoption is set, warnings normally printed as a result of being unable to 90af2b8e58SRobert Watsonperform the requested operation will be suppressed. 91f7fc4669SLuigi Rizzo.Pp 92af68c71aSMatthew D FlemingIf the 93af68c71aSMatthew D Fleming.Fl v 94af68c71aSMatthew D Flemingoption is set, the variable name will be printed out for the 95af68c71aSMatthew D Flemingenvironment variable in addition to the value when 96af68c71aSMatthew D Fleming.Nm 97af68c71aSMatthew D Flemingis executed with a variable name. 98af68c71aSMatthew D Fleming.Pp 99f7fc4669SLuigi RizzoVariables can be added to the kernel environment using the 100440c834cSSergey Kandaurov.Pa /boot/loader.conf 101f7fc4669SLuigi Rizzofile, or also statically compiled into the kernel using the statement 102f7fc4669SLuigi Rizzo.Pp 103f7fc4669SLuigi Rizzo.Dl Ic env Ar filename 104f7fc4669SLuigi Rizzo.Pp 105f7fc4669SLuigi Rizzoin the kernel config file. 106f7fc4669SLuigi RizzoThe file can contain lines of the form 107f7fc4669SLuigi Rizzo.Pp 1083ed338ddSMaxim Konovalov.Dl name = "value" # this is a comment 109f7fc4669SLuigi Rizzo.Pp 110f3aff7c9SBenjamin Kadukwhere whitespace around 111f3aff7c9SBenjamin Kaduk.Sq name 112f3aff7c9SBenjamin Kadukand 113f3aff7c9SBenjamin Kaduk.Sq = , 114f3aff7c9SBenjamin Kadukand everything after a 115f3aff7c9SBenjamin Kaduk.Sq # 116f3aff7c9SBenjamin Kadukcharacter, are ignored. 117f3aff7c9SBenjamin KadukAlmost any printable character except 118f3aff7c9SBenjamin Kaduk.Sq = 119f3aff7c9SBenjamin Kadukis acceptable as part of a name. 120f3aff7c9SBenjamin KadukQuotes are optional and necessary only if the value contains whitespace. 121a8f6fe34SFernando Apesteguía.Sh EXAMPLES 122a8f6fe34SFernando ApesteguíaShow kernel probe hints variable names and filter for the uart 123a8f6fe34SFernando Apesteguíadevice 124a8f6fe34SFernando Apesteguía.Bd -literal -offset indent 125a8f6fe34SFernando Apesteguía$ kenv -h -N | grep uart 126a8f6fe34SFernando Apesteguíahint.uart.0.at 127a8f6fe34SFernando Apesteguíahint.uart.0.flags 128a8f6fe34SFernando Apesteguíahint.uart.0.irq 129a8f6fe34SFernando Apesteguíahint.uart.0.port 130a8f6fe34SFernando Apesteguíahint.uart.1.at 131a8f6fe34SFernando Apesteguíahint.uart.1.irq 132a8f6fe34SFernando Apesteguíahint.uart.1.port 133a8f6fe34SFernando Apesteguía.Ed 134a8f6fe34SFernando Apesteguía.Pp 135a8f6fe34SFernando ApesteguíaShow the value of a specific variable: 136a8f6fe34SFernando Apesteguía.Bd -literal -offset indent 137a8f6fe34SFernando Apesteguía$ kenv hint.uart.1.at 138a8f6fe34SFernando Apesteguíaisa 139a8f6fe34SFernando Apesteguía.Ed 140a8f6fe34SFernando Apesteguía.Pp 141a8f6fe34SFernando ApesteguíaSame as above but adding the name of the variable in the report: 142a8f6fe34SFernando Apesteguía.Bd -literal -offset indent 143a8f6fe34SFernando Apesteguía$ kenv -v hint.uart.1.at 144a8f6fe34SFernando Apesteguíahint.uart.1.at="isa" 145a8f6fe34SFernando Apesteguía.Ed 146a8f6fe34SFernando Apesteguía.Pp 147a8f6fe34SFernando ApesteguíaTry to delete a variable and suppress warnings if any: 148a8f6fe34SFernando Apesteguía.Bd -literal -offset indent 149a8f6fe34SFernando Apesteguía$ kenv -q -u hint.uart.1.at 150a8f6fe34SFernando Apesteguía.Ed 151a8f6fe34SFernando Apesteguía.Pp 152a8f6fe34SFernando ApesteguíaSet the value of the 153a8f6fe34SFernando Apesteguía.Ev verbose_loading 154a8f6fe34SFernando Apesteguíavariable 155a8f6fe34SFernando Apesteguía.Bd -literal -offset indent 156a8f6fe34SFernando Apesteguía$ kenv verbose_loading="YES" 157a8f6fe34SFernando Apesteguíaverbose_loading="YES" 158a8f6fe34SFernando Apesteguía.Ed 159c87a63c1SPeter Wemm.Sh SEE ALSO 1607eab3d34SMaxime Henrion.Xr kenv 2 , 161f7fc4669SLuigi Rizzo.Xr config 5 , 162f7fc4669SLuigi Rizzo.Xr loader.conf 5 , 163c87a63c1SPeter Wemm.Xr loader 8 164c87a63c1SPeter Wemm.Sh HISTORY 165db1909f7SRuslan ErmilovThe 1668fe908efSRuslan Ermilov.Nm 167db1909f7SRuslan Ermilovutility appeared in 168d9a7d86cSBen Smithurst.Fx 4.1.1 . 169