efi

package
v0.0.0-...-f6d5d5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package efi supports reading EFI variables.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoEFISystem = errors.New("not a supported EFI system")

Functions

func MockVars

func MockVars(vars map[string][]byte, attrs map[string]VariableAttr) (restore func())

MockVars mocks EFI variables as read by ReadVar*, only to be used from tests. Set vars to nil to mock a non-EFI system.

Types

type VariableAttr

type VariableAttr uint32
const (
	VariableNonVolatile       VariableAttr = 0x00000001
	VariableBootServiceAccess VariableAttr = 0x00000002
	VariableRuntimeAccess     VariableAttr = 0x00000004
)

see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/efi.h?h=v5.4.32

func ReadVarBytes

func ReadVarBytes(name string) ([]byte, VariableAttr, error)

ReadVarBytes will attempt to read the bytes of the value of the specified EFI variable, specified by its full name composed of the variable name and vendor ID. It also returns the attribute value attached to it. It expects to use the efivars filesystem at /sys/firmware/efi/efivars. https://www.kernel.org/doc/Documentation/filesystems/efivarfs.txt for more details.

func ReadVarString

func ReadVarString(name string) (string, VariableAttr, error)

ReadVarString will attempt to read the string value of the specified EFI variable, specified by its full name composed of the variable name and vendor ID. The string value is expected to be encoded as UTF16. It also returns the attribute value attached to it. It expects to use the efivars filesystem at /sys/firmware/efi/efivars. https://www.kernel.org/doc/Documentation/filesystems/efivarfs.txt for more details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL