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