efivars

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package efivars provides bindings to the efivars and efiboot libraries

Index

Constants

View Source
const (
	BootAbbrevNone            = C.EFIBOOT_ABBREV_NONE             // Do not abbreviate things
	BootAbbrevHD              = C.EFIBOOT_ABBREV_HD               // Abbreviate HD
	BootAbbrevFile            = C.EFIBOOT_ABBREV_FILE             // Abbreviate file path
	BootOptionWriteSignature  = C.EFIBOOT_OPTIONS_WRITE_SIGNATURE // Write MBR signature to boot partition
	BootOptionIgnorePMBRError = C.EFIBOOT_OPTIONS_IGNORE_PMBR_ERR // Ignore PBMR error
)

Various options for GenerateFileDevicePath. We ignore the Edd10 abbreviation option, as it requires a vaarg.

View Source
const (
	VariableNonVolatile       = C.EFI_VARIABLE_NON_VOLATILE
	VariableBootServiceAccess = C.EFI_VARIABLE_BOOTSERVICE_ACCESS
	VariableRuntimeAccess     = C.EFI_VARIABLE_RUNTIME_ACCESS
)

Various attributes for variables

View Source
const (
	LoadOptionActive = 0x00000001
)

Constants for LoadOption attributes

Variables

View Source
var GUIDGlobal, _ = NewGUIDFromString("8be4df61-93ca-11d2-aa0d-00e098032b8c")

GUIDGlobal is the global UEFI GUID

Functions

func DelVariable

func DelVariable(guid GUID, name string) error

DelVariable deletes the specified variable, or returns an error if it fails.

func GetVariable

func GetVariable(guid GUID, name string) (data []byte, attrs uint32)

GetVariable retrieves the content of the specified variable. It returns the content and the attributes

func GetVariableNames

func GetVariableNames(filterGUID GUID) []string

GetVariableNames returns all variable names for the given GUID.

func NewLoadOptionArgumentFromUTF8

func NewLoadOptionArgumentFromUTF8(data string) ([]byte, error)

NewLoadOptionArgumentFromUTF8 converts a UTF-8 string into a UCS-2 encoded argument.

func SetVariable

func SetVariable(guid GUID, name string, data []byte, attrs uint32, mode os.FileMode) error

SetVariable sets the specified variable to the specified data

func VariablesSupported

func VariablesSupported() bool

VariablesSupported returns if variables are supported

Types

type DevicePath

type DevicePath []byte

DevicePath represents a device path.

func NewDevicePath

func NewDevicePath(filepath string, options uint32) (DevicePath, error)

NewDevicePath generates a UEFI device file path from a given real file path. It returns it as a slice of bytes which can later be parsed into a DevicePath object.

type GUID

type GUID = C.efi_guid_t

GUID of a variable

func NewGUIDFromString

func NewGUIDFromString(guidStr string) (GUID, error)

NewGUIDFromString returns a new GUID based on the passed string

type LoadOption

type LoadOption struct {
	Data []byte
}

LoadOption represents an EFI load option.

func NewLoadOption

func NewLoadOption(attributes uint32, dp DevicePath, desc string, optionalData []byte) (LoadOption, error)

NewLoadOption binds efi_loadopt_create() in a Go-style fashion, it creates a load option. The returned load option's data can be set as a Boot variable.

func NewLoadOptionFromVariable

func NewLoadOptionFromVariable(variable []byte) (LoadOption, error)

NewLoadOptionFromVariable reinterprets the specified slice as a load option.

func (LoadOption) Desc

func (lo LoadOption) Desc() string

Desc returns the description/label of a load option

func (LoadOption) Path

func (lo LoadOption) Path() DevicePath

Path returns the device path.

Jump to

Keyboard shortcuts

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