Documentation
¶
Overview ¶
Package efivars provides bindings to the efivars and efiboot libraries
Index ¶
- Constants
- Variables
- func DelVariable(guid GUID, name string) error
- func GetVariable(guid GUID, name string) (data []byte, attrs uint32)
- func GetVariableNames(filterGUID GUID) []string
- func NewLoadOptionArgumentFromUTF8(data string) ([]byte, error)
- func SetVariable(guid GUID, name string, data []byte, attrs uint32, mode os.FileMode) error
- func VariablesSupported() bool
- type DevicePath
- type GUID
- type LoadOption
Constants ¶
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.
const ( VariableNonVolatile = C.EFI_VARIABLE_NON_VOLATILE VariableBootServiceAccess = C.EFI_VARIABLE_BOOTSERVICE_ACCESS VariableRuntimeAccess = C.EFI_VARIABLE_RUNTIME_ACCESS )
Various attributes for variables
const (
LoadOptionActive = 0x00000001
)
Constants for LoadOption attributes
Variables ¶
var GUIDGlobal, _ = NewGUIDFromString("8be4df61-93ca-11d2-aa0d-00e098032b8c")
GUIDGlobal is the global UEFI GUID
Functions ¶
func DelVariable ¶
DelVariable deletes the specified variable, or returns an error if it fails.
func GetVariable ¶
GetVariable retrieves the content of the specified variable. It returns the content and the attributes
func GetVariableNames ¶
GetVariableNames returns all variable names for the given GUID.
func NewLoadOptionArgumentFromUTF8 ¶
NewLoadOptionArgumentFromUTF8 converts a UTF-8 string into a UCS-2 encoded argument.
func SetVariable ¶
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 ¶
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