152467047SWarner Losh.\" 23c0dcbfcSWarner Losh.\" Copyright (c) 2017-2021 Netflix, Inc. 34b844f8dSWarner Losh.\" 44b844f8dSWarner Losh.\" Redistribution and use in source and binary forms, with or without 54b844f8dSWarner Losh.\" modification, are permitted provided that the following conditions 64b844f8dSWarner Losh.\" are met: 74b844f8dSWarner Losh.\" 1. Redistributions of source code must retain the above copyright 84b844f8dSWarner Losh.\" notice, this list of conditions and the following disclaimer. 94b844f8dSWarner Losh.\" 2. Redistributions in binary form must reproduce the above copyright 104b844f8dSWarner Losh.\" notice, this list of conditions and the following disclaimer in the 114b844f8dSWarner Losh.\" documentation and/or other materials provided with the distribution. 124b844f8dSWarner Losh.\" 13b2a7ac48SWarner Losh.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 144b844f8dSWarner Losh.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 154b844f8dSWarner Losh.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16b2a7ac48SWarner Losh.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 174b844f8dSWarner Losh.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 184b844f8dSWarner Losh.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 194b844f8dSWarner Losh.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 204b844f8dSWarner Losh.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 214b844f8dSWarner Losh.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 224b844f8dSWarner Losh.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 234b844f8dSWarner Losh.\" SUCH DAMAGE. 244b844f8dSWarner Losh.\" 253c0dcbfcSWarner Losh.Dd April 7, 2021 264b844f8dSWarner Losh.Dt EFIVAR 8 274b844f8dSWarner Losh.Os 284b844f8dSWarner Losh.Sh NAME 294b844f8dSWarner Losh.Nm efivar 3098120473SBenjamin Kaduk.Nd UEFI environment variable interaction 314b844f8dSWarner Losh.Sh SYNOPSIS 324b844f8dSWarner Losh.Nm 333c0dcbfcSWarner Losh.Op Fl abdDHlLNpqRtuw 344b844f8dSWarner Losh.Op Fl n Ar name 354b844f8dSWarner Losh.Op Fl f Ar file 364b844f8dSWarner Losh.Op Fl -append 374b844f8dSWarner Losh.Op Fl -ascii 384b844f8dSWarner Losh.Op Fl -attributes 394b844f8dSWarner Losh.Op Fl -binary 404b844f8dSWarner Losh.Op Fl -delete 412f2f5c67SWarner Losh.Op Fl -device-path 424b844f8dSWarner Losh.Op Fl -fromfile Ar file 4316445670SWarner Losh.Op Fl -guid 444b844f8dSWarner Losh.Op Fl -hex 454b844f8dSWarner Losh.Op Fl -list-guids 464b844f8dSWarner Losh.Op Fl -list 477b1f3e08SRebecca Cran.Op Fl -load-option 484b844f8dSWarner Losh.Op Fl -name Ar name 494b844f8dSWarner Losh.Op Fl -no-name 504b844f8dSWarner Losh.Op Fl -print 514b844f8dSWarner Losh.Op Fl -print-decimal 523c0dcbfcSWarner Losh.Op Fl -quiet 534b844f8dSWarner Losh.Op Fl -raw-guid 54b0da7c79SWarner Losh.Op Fl -utf8 554b844f8dSWarner Losh.Op Fl -write 564b844f8dSWarner Losh.Sh DESCRIPTION 574b844f8dSWarner LoshThis program manages 584b844f8dSWarner Losh.Dq Unified Extensible Firmware Interface 594b844f8dSWarner Losh.Pq UEFI 604b844f8dSWarner Loshenvironment variables. 61*54b75eddSJens SchweikhardtUEFI variables have three parts: A namespace, a name and a value. 6298120473SBenjamin KadukThe namespace is a GUID that is self assigned by the group defining the 634b844f8dSWarner Loshvariables. 644b844f8dSWarner LoshThe name is a Unicode name for the variable. 654b844f8dSWarner LoshThe value is binary data. 664b844f8dSWarner LoshAll Unicode data is presented to the user as UTF-8. 674b844f8dSWarner Losh.Pp 684b844f8dSWarner LoshThe following options are available: 694b844f8dSWarner Losh.Bl -tag -width 20m 704b844f8dSWarner Losh.It Fl n Ar name Fl -name Ar name 714b844f8dSWarner LoshSpecify the name of the variable to operate on. 724b844f8dSWarner LoshThe 734b844f8dSWarner Losh.Ar name 7498120473SBenjamin Kadukargument is the GUID of the variable, followed by a dash, followed by the 754b844f8dSWarner LoshUEFI variable name. 764b844f8dSWarner LoshThe GUID may be in numeric format, or may be one of the well known 77*54b75eddSJens Schweikhardtsymbolic names (see 784b844f8dSWarner Losh.Fl -list-guids 794b844f8dSWarner Loshfor a complete list). 804b844f8dSWarner Losh.It Fl f Ar file Fl -fromfile Ar file 814b844f8dSWarner LoshWhen writing or appending to a variable, take the data for the 824b844f8dSWarner Loshvariable's value from 834b844f8dSWarner Losh.Ar file 844b844f8dSWarner Loshinstead of from the command line. 854b844f8dSWarner LoshThis flag implies 864b844f8dSWarner Losh.Fl -write 874b844f8dSWarner Loshunless the 884b844f8dSWarner Losh.Fl -append 89e08bb109SWarner Loshor 90e08bb109SWarner Losh.Fl -print 91e08bb109SWarner Loshflags are given. 92e08bb109SWarner LoshThis behavior is not well understood and is currently unimplemented 93e08bb109SWarner Loshfor writes. 94e08bb109SWarner LoshWhen 95e08bb109SWarner Losh.Fl -print 96e08bb109SWarner Loshis specified, the contents of the file are used as the value to 97e08bb109SWarner Loshprint using any other specified flags. 98e08bb109SWarner LoshThis is used primarily for testing purposes for more complicated 99e08bb109SWarner Loshvariable decoding. 1004b844f8dSWarner Losh.It Fl a Fl -append 1014b844f8dSWarner LoshAppend the specified value to the UEFI variable rather than replacing 10298120473SBenjamin Kadukit. 1034b844f8dSWarner Losh.It Fl t Ar attr Fl -attributes Ar attr 10498120473SBenjamin KadukSpecify, in hexadecimal, the attributes for this 1054b844f8dSWarner Loshvariable. 1064b844f8dSWarner LoshSee section 7.2 (GetVariable subsection, Related Definitions) of the 1074b844f8dSWarner LoshUEFI Specification for hex values to use. 1084b844f8dSWarner Losh.It Fl A Fl -ascii 109*54b75eddSJens SchweikhardtDisplay the variable data as modified ASCII: All printable characters 1104b844f8dSWarner Loshare printed, while unprintable characters are rendered as a two-digit 11198120473SBenjamin Kadukhexadecimal number preceded by a % character. 1129013a3a0SWarner Losh.It Fl b Fl -binary 1134b844f8dSWarner LoshDisplay the variable data as binary data. 1144b844f8dSWarner LoshUsually will be used with the 1154b844f8dSWarner Losh.Fl N 1164b844f8dSWarner Loshor 1174b844f8dSWarner Losh.Fl -no-name 1184b844f8dSWarner Loshflag. 1194b844f8dSWarner LoshUseful in scripts. 1204b844f8dSWarner Losh.It Fl D Fl -delete 1214b844f8dSWarner LoshDelete the specified variable. 1224b844f8dSWarner LoshMay not be used with either the 1234b844f8dSWarner Losh.Fl -write 1244b844f8dSWarner Loshor the 1254b844f8dSWarner Losh.Fl -append 1264b844f8dSWarner Loshflags. 1274b844f8dSWarner LoshNo 1284b844f8dSWarner Losh.Ar value 1294b844f8dSWarner Loshmay be specified. 1302f2f5c67SWarner Losh.It Fl d Fl -device Fl -device-path 1312f2f5c67SWarner LoshInterpret the variables printed as UEFI device paths and print the 1322f2f5c67SWarner LoshUEFI standard string representation. 13316445670SWarner Losh.It Fl g Fl -guid 134377d7c41SMateusz PiotrowskiConvert GUIDs to names if they are known 135*54b75eddSJens Schweikhardt.Po and show them in 136377d7c41SMateusz Piotrowski.Fl -list-guids 137377d7c41SMateusz Piotrowski.Pc . 1384b844f8dSWarner Losh.It Fl H Fl -hex 1394b844f8dSWarner LoshList variable data as a hex dump. 1404b844f8dSWarner Losh.It Fl L Fl -list-guids 1414b844f8dSWarner LoshLists the well known GUIDs. 1424b844f8dSWarner LoshThe names listed here may be used in place of the numeric GUID values. 143*54b75eddSJens SchweikhardtThese names will replace the numeric GUID values unless the 1444b844f8dSWarner Losh.Fl -raw-guid 1454b844f8dSWarner Loshflag is specified. 1464b844f8dSWarner Losh.It Fl l Fl -list 1474b844f8dSWarner LoshList all the variables. 1484b844f8dSWarner LoshIf the 1494b844f8dSWarner Losh.Fl -print 1504b844f8dSWarner Loshflag is also listed, their values will be displayed. 1517b1f3e08SRebecca Cran.It Fl -load-option 152*54b75eddSJens SchweikhardtDecode the variable as if it were a UEFI Boot Option, including information 153*54b75eddSJens Schweikhardtabout what device and/or paths the UEFI DevicePaths decode to. 1544b844f8dSWarner Losh.It Fl N Fl -no-name 1554b844f8dSWarner LoshDo not display the variable name. 1564b844f8dSWarner Losh.It Fl p Fl -print 1574b844f8dSWarner LoshPrint the value of the variable. 1583c0dcbfcSWarner Losh.It Fl q Fl -quiet 159*54b75eddSJens SchweikhardtWhen an error occurs, exit with a non-zero value without outputting 160*54b75eddSJens Schweikhardtany error messages. 1613c0dcbfcSWarner LoshOtherwise, produce the normal output and exit with a zero status. 1624b844f8dSWarner Losh.It Fl R Fl -raw-guid 1634b844f8dSWarner LoshDo not substitute well known names for GUID numeric values in output. 164b0da7c79SWarner Losh.It Fl u Fl -utf8 165b0da7c79SWarner LoshTreat the value of the variable as UCS2 and convert it to UTF8 and 166b0da7c79SWarner Loshprint the result. 1674b844f8dSWarner Losh.It Fl w Fl -write 1682f2f5c67SWarner LoshWrite (replace) the variable specified with the value specified from 1692f2f5c67SWarner Loshstandard input. 1702f2f5c67SWarner LoshNo command line option to do this is available since UEFI variables 1712f2f5c67SWarner Loshare binary structures rather than strings. 1722f2f5c67SWarner Losh.Xr echo 1 1732f2f5c67SWarner Losh.Fl n 1742f2f5c67SWarner Loshcan be used to specify simple strings. 1754b844f8dSWarner Losh.It Ar name 1764b844f8dSWarner LoshDisplay the 1774b844f8dSWarner Losh.Ar name 1784b844f8dSWarner Loshenvironment variable. 17998120473SBenjamin Kaduk.El 1804b844f8dSWarner Losh.Sh COMPATIBILITY 1814b844f8dSWarner LoshThe 1824b844f8dSWarner Losh.Nm 18398120473SBenjamin Kadukprogram is intended to be compatible (strict superset) with a program 18498120473SBenjamin Kadukof the same name included in the Red Hat libefivar package, 18598120473SBenjamin Kadukbut the 1862f2f5c67SWarner Losh.Fl d 1872f2f5c67SWarner Loshand 1882f2f5c67SWarner Losh.Fl -print-decimal 18998120473SBenjamin Kadukflags are not implemented and never will be. 19098120473SBenjamin Kaduk.Pp 1912f2f5c67SWarner LoshThe 1922f2f5c67SWarner Losh.Fl d 19398120473SBenjamin Kadukflag is short for 1942f2f5c67SWarner Losh.Fl -device-path . 1954b844f8dSWarner Losh.Sh SEE ALSO 1964b844f8dSWarner LoshAppendix A of the UEFI specification has the format for GUIDs. 1974b844f8dSWarner LoshAll GUIDs 1984b844f8dSWarner Losh.Dq Globally Unique Identifiers 1994b844f8dSWarner Loshhave the format described in RFC 4122. 2002f2f5c67SWarner Losh.Sh HISTORY 2012f2f5c67SWarner LoshThe 2022f2f5c67SWarner Losh.Nm 2032f2f5c67SWarner Loshutility first appeared in 204f0c9042bSGlen Barber.Fx 11.1 . 205