Commit Graph

29 Commits

Author SHA1 Message Date
Rebecca Cran
7b1f3e08d9 Document the efivar --load-option option
Reviewed by:	imp, kevans
Sponsored by:	Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D19263
2019-03-07 00:01:28 +00:00
Rebecca Cran
748f247a44 Add the unix path to the output of efivar --load-option
Reviewed by:	imp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D19242
2019-02-20 05:19:16 +00:00
Warner Losh
52467047aa Regularize the Netflix copyright
Use recent best practices for Copyright form at the top of
the license:
1. Remove all the All Rights Reserved clauses on our stuff. Where we
   piggybacked others, use a separate line to make things clear.
2. Use "Netflix, Inc." everywhere.
3. Use a single line for the copyright for grep friendliness.
4. Use date ranges in all places for our stuff.

Approved by: Netflix Legal (who gave me the form), adrian@ (pmc files)
2019-02-04 21:28:25 +00:00
Warner Losh
92f9212ba6 Fix pointer arithmetic botch.
Pointer subtraction to find size only works with char pointers.

Noticed by: jhb@
Sponsored by: Netflix, Inc
2018-10-26 23:44:39 +00:00
Warner Losh
46fabdaffc Require that we have at least a device path header before
trying to decode the next device path.

Sponsored by: Netflix, Inc
2018-10-26 22:49:25 +00:00
Warner Losh
e08bb1091c Implenent --fromfile to read variable values when printing variables
So

./efivar --fromfile Boot0001.bin --print --load-option

will take the value from Boot0001.bin file and then decode it as if it
were a load-option. This is useful for debugging handling of such
variables that may be hanging the boot for some people.

Sponsored by: Netflix, Inc
2018-10-26 22:13:40 +00:00
Warner Losh
96723f5a89 Iniailize str so ucs2_to_utf8 won't free stack garbage.
CID: 1381037
Sponsored by: Netflix
2017-12-12 19:26:28 +00:00
Warner Losh
a2bb1fffdf Add forgotten libgeom.
Sponsored by: Netflix
2017-12-02 15:25:45 +00:00
Ed Maste
f4d8e4954d efivar: add missing getopt 'u' option 2017-11-27 19:35:21 +00:00
Warner Losh
ca987d4641 Move sys/boot to stand. Fix all references to new location
Sponsored by:	Netflix
2017-11-14 23:02:19 +00:00
Warner Losh
831bec1163 Simplify the efivar interface a little.
We started out having Linux compatible libefivar interfaces. This was
in anticipation of porting the GPL'd efibootmgr to FreeBSD via a
port. However, since we need that functionality in the base, that port
isn't going to happened. It also appears that efivar is a private
library that's not used much outside a command line util and
efibootmgr. Reduce compatibility with the Linux version a little by
removing the mode parameter to efi_set_variable (which was unused on
FreeBSD, and not set to something useful in the code we'd
written). Also remove some efi error routines that were never
implemented and existed only to placate early GPL efibootmgr porting
experiments.

Suggested by: Matt Williams
Sponsored by: Netflix
2017-11-10 23:30:23 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Warner Losh
5709a4b5a1 Create efi utility printing routines
Split out asciidump, utf8dump, bindump, and hexdump into a separate
file efiutil.c. Implement new efi_print_load_option for printing out
the EFI_LOADER_OPTION data structure used to specify different options
to the UEFI boot manager.

Sponsored by: Netflix
2017-09-07 07:30:19 +00:00
Warner Losh
b0da7c79f1 Add UCS2->UTF8 option.
Many UEFI variables are UCS2 strings (some NUL terminated, others
not). Add --utf8 (-u) to convert UCS2 strings to UTF8 before printing.

Sponsored by: Netflix
2017-08-31 17:53:50 +00:00
Glen Barber
f0c9042b38 Correct the "first appeared in" version for efivar(8).
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-05-22 13:55:59 +00:00
Benjamin Kaduk
98120473ab Updates for efivar.8
Fix spelling [1], appease igor and mandoc -Tlint, and adopt the
language style to be more consistent with our corpus.

PR:		219434 [1]
Submitted by:	olgeni [1]
2017-05-21 22:10:08 +00:00
Warner Losh
2f2f5c6728 Finish implementing -d/--device/--device-path flag to print variable
as if it were a device path.

Remove language about a=b syntax on the command line. This will not be
implemented due to its limited usefulness. UEFI variables are binary
blobs, on the whole, and a simple work around exists for
strings. Clarify that the new value of the variable is taken from
stdin. Update manual with history.

Sponsored by: Netflix
2017-03-09 00:31:36 +00:00
Warner Losh
f2d626ab0e If the guid specified can't be decoded as a GUID, try looking it up in
the known guid to name table.

Sponsored by: Netflix
2017-03-03 20:23:18 +00:00
Warner Losh
9e4a51a860 Implement -d / --device-path to print the ascii representation of a variable that contains a UEFI device path.
Sponsored by: Netflix
2017-03-03 20:23:14 +00:00
Warner Losh
1644567051 Implement --guid/-g to print the known GUIDs as human readable. The
list of known GUIDs can be found with --list-guids.

Sponsored by: Netflix
2017-03-03 20:23:10 +00:00
Warner Losh
4a110fbfa7 Actually implement efivar -L
Sponsored by: Netflix
2017-03-03 20:23:05 +00:00
Warner Losh
902af7c6f5 Print just the variables when we're not printing the values.
Sponsored by: Netflix
2017-03-03 20:23:01 +00:00
Warner Losh
35a419a2cb Exit when we can't print a variable.
Exit after printing a message on stderr when we can't get a
message. This is slightly different than linux, but keeps shell
scripts from thinking the value of the variable is the error message
and so is a net win.

Sponsored by: Netflix
2017-02-25 00:09:26 +00:00
Bryan Drewery
d329c46cfa DIRDEPS_BUILD: Connect new dependencies.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:23 +00:00
Warner Losh
fe7d9f8ebc style(9) nit: space after |. 2016-10-16 05:53:18 +00:00
Warner Losh
55ff82c0db Implement -t. Use symbolic names in place of the magical 0x7.
Submitted by: ambrisko@
2016-10-15 06:16:35 +00:00
Warner Losh
9013a3a0de 'b' is short for --binary, it isn't 'a'.
PR: 213437
Submitted by: Ganael LAPLANCHE
2016-10-13 17:03:54 +00:00
Warner Losh
b2a7ac4802 Fix building on i386 and arm. But 'public domain' headers on the files
with no creative content. Include "lost" changes from git:
o Use /dev/efi instead of /dev/efidev
o Remove redundant NULL checks.

Submitted by: kib@, dim@, zbb@, emaste@
2016-10-13 06:56:23 +00:00
Warner Losh
4b844f8d99 Add efivar(1) to manipulate EFI variables. It uses a similar command
line interface to the Linux program, as well as adding a number of
useful features to make using it in shell scripts easier (since we
don't have a filesystem to fall back on interacting with).

Differential Revision: https://reviews.freebsd.org/D8128
Reviewed by: kib@, wblock@, Ganael Laplanche
2016-10-11 22:31:45 +00:00