Skip to contentSkip to conversation

Add efi getenv command

PATCH New Matthew Garrett 1 participant 1 message Jan 24, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add efi getenv command

Add a command to obtain the contents of EFI firmware variables.

---
 docs/grub.texi                  |   7 ++
 grub-core/Makefile.core.def     |   7 ++
 grub-core/commands/efi/getenv.c | 153 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 167 insertions(+)
 create mode 100644 grub-core/commands/efi/getenv.c
docs/grub.texi +7 -0
index b9ddb9b..4469638 100644
@@ -3818,6 +3818,7 @@ you forget a command, you can run the command @command{help}
 * eval::                        Evaluate agruments as GRUB commands
 * export::                      Export an environment variable
 * false::                       Do nothing, unsuccessfully
+* getenv::                      Retrieve an EFI firmware variable
 * gettext::                     Translate a string
 * gptsync::                     Fill an MBR based on GPT entries
 * halt::                        Shut down your computer
@@ -4258,6 +4259,12 @@ Do nothing, unsuccessfully.  This is mainly useful in control constructs
 such as @code{if} and @code{while} (@pxref{Shell-like scripting}).
 @end deffn
 
+@node getenv
+@subsection getenv
+
+@deffn Command getenv [@option{-e}] [@option{-g}] envvar
+Retrieves an EFI variable with the name provided by @option{-e} and the GUID
+provied by @option{-g} and stores it in environment variable @var{envvar}
 
 @node gettext
 @subsection gettext
grub-core/Makefile.core.def +7 -0
index 2dfa22a..db77a7f 100644
@@ -817,6 +817,13 @@ module = {
 };
 
 module = {
+  name = getenv;
+  common = commands/efi/getenv.c;
+  enable = i386_efi;
+  enable = x86_64_efi;
+};
+
+module = {
   name = gptsync;
   common = commands/gptsync.c;
 };
grub-core/commands/efi/getenv.c new file +153 -0

153 lines not on this page · raw message

Signature · 1 line
2.9.3