xref: /freebsd/usr.sbin/efivar/efivar.8 (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1.\"
2.\" Copyright (c) 2017-2021 Netflix, Inc.
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 AUTHOR 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 AUTHOR 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 April 7, 2021
26.Dt EFIVAR 8
27.Os
28.Sh NAME
29.Nm efivar
30.Nd UEFI environment variable interaction
31.Sh SYNOPSIS
32.Nm
33.Op Fl abdDHlLNpqRtuw
34.Op Fl n Ar name
35.Op Fl f Ar file
36.Op Fl -append
37.Op Fl -ascii
38.Op Fl -attributes
39.Op Fl -binary
40.Op Fl -delete
41.Op Fl -device-path
42.Op Fl -fromfile Ar file
43.Op Fl -guid
44.Op Fl -hex
45.Op Fl -list-guids
46.Op Fl -list
47.Op Fl -load-option
48.Op Fl -name Ar name
49.Op Fl -no-name
50.Op Fl -print
51.Op Fl -print-decimal
52.Op Fl -quiet
53.Op Fl -raw-guid
54.Op Fl -utf8
55.Op Fl -write
56.Sh DESCRIPTION
57This program manages
58.Dq Unified Extensible Firmware Interface
59.Pq UEFI
60environment variables.
61UEFI variables have three parts: A namespace, a name and a value.
62The namespace is a GUID that is self assigned by the group defining the
63variables.
64The name is a Unicode name for the variable.
65The value is binary data.
66All Unicode data is presented to the user as UTF-8.
67.Pp
68The following options are available:
69.Bl -tag -width 20m
70.It Fl n Ar name Fl -name Ar name
71Specify the name of the variable to operate on.
72The
73.Ar name
74argument is the GUID of the variable, followed by a dash, followed by the
75UEFI variable name.
76The GUID may be in numeric format, or may be one of the well known
77symbolic names (see
78.Fl -list-guids
79for a complete list).
80.It Fl f Ar file Fl -fromfile Ar file
81When writing or appending to a variable, take the data for the
82variable's value from
83.Ar file
84instead of from the command line.
85This flag implies
86.Fl -write
87unless the
88.Fl -append
89or
90.Fl -print
91flags are given.
92This behavior is not well understood and is currently unimplemented
93for writes.
94When
95.Fl -print
96is specified, the contents of the file are used as the value to
97print using any other specified flags.
98This is used primarily for testing purposes for more complicated
99variable decoding.
100.It Fl a Fl -append
101Append the specified value to the UEFI variable rather than replacing
102it.
103.It Fl t Ar attr Fl -attributes Ar attr
104Specify, in hexadecimal, the attributes for this
105variable.
106See section 7.2 (GetVariable subsection, Related Definitions) of the
107UEFI Specification for hex values to use.
108.It Fl A Fl -ascii
109Display the variable data as modified ASCII: All printable characters
110are printed, while unprintable characters are rendered as a two-digit
111hexadecimal number preceded by a % character.
112.It Fl b Fl -binary
113Display the variable data as binary data.
114Usually will be used with the
115.Fl N
116or
117.Fl -no-name
118flag.
119Useful in scripts.
120.It Fl D Fl -delete
121Delete the specified variable.
122May not be used with either the
123.Fl -write
124or the
125.Fl -append
126flags.
127No
128.Ar value
129may be specified.
130.It Fl d Fl -device Fl -device-path
131Interpret the variables printed as UEFI device paths and print the
132UEFI standard string representation.
133.It Fl g Fl -guid
134Convert GUIDs to names if they are known
135.Po and show them in
136.Fl -list-guids
137.Pc .
138.It Fl H Fl -hex
139List variable data as a hex dump.
140.It Fl L Fl -list-guids
141Lists the well known GUIDs.
142The names listed here may be used in place of the numeric GUID values.
143These names will replace the numeric GUID values unless the
144.Fl -raw-guid
145flag is specified.
146.It Fl l Fl -list
147List all the variables.
148If the
149.Fl -print
150flag is also listed, their values will be displayed.
151.It Fl -load-option
152Decode the variable as if it were a UEFI Boot Option, including information
153about what device and/or paths the UEFI DevicePaths decode to.
154.It Fl N Fl -no-name
155Do not display the variable name.
156.It Fl p Fl -print
157Print the value of the variable.
158.It Fl q Fl -quiet
159When an error occurs, exit with a non-zero value without outputting
160any error messages.
161Otherwise, produce the normal output and exit with a zero status.
162.It Fl R Fl -raw-guid
163Do not substitute well known names for GUID numeric values in output.
164.It Fl u Fl -utf8
165Treat the value of the variable as UCS2 and convert it to UTF8 and
166print the result.
167.It Fl w Fl -write
168Write (replace) the variable specified with the value specified from
169standard input.
170No command line option to do this is available since UEFI variables
171are binary structures rather than strings.
172.Xr echo 1
173.Fl n
174can be used to specify simple strings.
175.It Ar name
176Display the
177.Ar name
178environment variable.
179.El
180.Sh COMPATIBILITY
181The
182.Nm
183program is intended to be compatible (strict superset) with a program
184of the same name included in the Red Hat libefivar package,
185but the
186.Fl d
187and
188.Fl -print-decimal
189flags are not implemented and never will be.
190.Pp
191The
192.Fl d
193flag is short for
194.Fl -device-path .
195.Sh SEE ALSO
196Appendix A of the UEFI specification has the format for GUIDs.
197All GUIDs
198.Dq Globally Unique Identifiers
199have the format described in RFC 4122.
200.Sh HISTORY
201The
202.Nm
203utility first appeared in
204.Fx 11.1 .
205