Documentation ¶
Overview ¶
Package efi contains a boot management library
Index ¶
- func GetVariableNames(efiVars Variables, filterGUID efi.GUID) (names []string, err error)
- func VariablesSupported(efiVars Variables) bool
- type BootEntry
- type BootEntryVariable
- type BootManager
- type MockEFIVariables
- func (m MockEFIVariables) DelVariable(_ efi.GUID, _ string) error
- func (m MockEFIVariables) GetVariable(guid efi.GUID, name string) (data []byte, attrs efi.VariableAttributes, err error)
- func (m MockEFIVariables) JSON() ([]byte, error)
- func (m MockEFIVariables) ListVariables() (out []efi.VariableDescriptor, err error)
- func (m MockEFIVariables) NewFileDevicePath(fpath string, _ efi_linux.FileDevicePathMode) (efi.DevicePath, error)
- func (m *MockEFIVariables) SetVariable(guid efi.GUID, name string, data []byte, attrs efi.VariableAttributes) error
- type RealEFIVariables
- func (v RealEFIVariables) DelVariable(guid efi.GUID, name string) error
- func (RealEFIVariables) GetVariable(guid efi.GUID, name string) (data []byte, attrs efi.VariableAttributes, err error)
- func (RealEFIVariables) ListVariables() ([]efi.VariableDescriptor, error)
- func (v RealEFIVariables) NewFileDevicePath(filepath string, mode efi_linux.FileDevicePathMode) (efi.DevicePath, error)
- func (RealEFIVariables) SetVariable(guid efi.GUID, name string, data []byte, attrs efi.VariableAttributes) error
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetVariableNames ¶
GetVariableNames returns the names of every variable with the specified GUID.
func VariablesSupported ¶
VariablesSupported indicates whether variables can be accessed.
Types ¶
type BootEntryVariable ¶
type BootEntryVariable struct { BootNumber int // number of the Boot variable, for example, for Boot0004 this is 4 Data []byte // the data of the variable Attributes efi.VariableAttributes // any attributes set on the variable LoadOption *efi.LoadOption // the data of the variable parsed as a load option, if it is a valid load option }
BootEntryVariable defines a boot entry variable
type BootManager ¶
type BootManager struct {
// contains filtered or unexported fields
}
BootManager manages the boot device selection menu entries (Boot0000...BootFFFF).
func NewBootManagerForVariables ¶
func NewBootManagerForVariables(efivars Variables) (BootManager, error)
NewBootManagerForVariables returns a boot manager for the given EFIVariables manager
func (*BootManager) FindOrCreateEntry ¶
func (bm *BootManager) FindOrCreateEntry(entry BootEntry, relativeTo string) (int, error)
FindOrCreateEntry finds a matching entry in the boot device selection menu, or creates one if it is missing.
It returns the number of the entry created, or -1 on failure, with error set.
The argument relativeTo specifies the directory entry.Filename is in.
func (*BootManager) NextFreeEntry ¶
func (bm *BootManager) NextFreeEntry() (int, error)
NextFreeEntry returns the number of the next free Boot variable.
func (*BootManager) PrependAndSetBootOrder ¶
func (bm *BootManager) PrependAndSetBootOrder(head []int) error
PrependAndSetBootOrder commits a new boot order or returns an error.
The boot order specified is prepended to the existing one, and the order is deduplicated before committing.
type MockEFIVariables ¶
type MockEFIVariables struct {
// contains filtered or unexported fields
}
MockEFIVariables implements an in-memory variable store.
func (MockEFIVariables) DelVariable ¶
func (m MockEFIVariables) DelVariable(_ efi.GUID, _ string) error
func (MockEFIVariables) GetVariable ¶
func (m MockEFIVariables) GetVariable(guid efi.GUID, name string) (data []byte, attrs efi.VariableAttributes, err error)
GetVariable implements EFIVariables
func (MockEFIVariables) JSON ¶
func (m MockEFIVariables) JSON() ([]byte, error)
JSON renders the MockEFIVariables as an Azure JSON config
func (MockEFIVariables) ListVariables ¶
func (m MockEFIVariables) ListVariables() (out []efi.VariableDescriptor, err error)
ListVariables implements EFIVariables
func (MockEFIVariables) NewFileDevicePath ¶
func (m MockEFIVariables) NewFileDevicePath(fpath string, _ efi_linux.FileDevicePathMode) (efi.DevicePath, error)
func (*MockEFIVariables) SetVariable ¶
func (m *MockEFIVariables) SetVariable(guid efi.GUID, name string, data []byte, attrs efi.VariableAttributes) error
SetVariable implements EFIVariables
type RealEFIVariables ¶
type RealEFIVariables struct{}
RealEFIVariables provides the real implementation of efivars
func (RealEFIVariables) DelVariable ¶
func (v RealEFIVariables) DelVariable(guid efi.GUID, name string) error
func (RealEFIVariables) GetVariable ¶
func (RealEFIVariables) GetVariable(guid efi.GUID, name string) (data []byte, attrs efi.VariableAttributes, err error)
GetVariable proxy
func (RealEFIVariables) ListVariables ¶
func (RealEFIVariables) ListVariables() ([]efi.VariableDescriptor, error)
ListVariables proxy
func (RealEFIVariables) NewFileDevicePath ¶
func (v RealEFIVariables) NewFileDevicePath(filepath string, mode efi_linux.FileDevicePathMode) (efi.DevicePath, error)
func (RealEFIVariables) SetVariable ¶
func (RealEFIVariables) SetVariable(guid efi.GUID, name string, data []byte, attrs efi.VariableAttributes) error
SetVariable proxy
type Variables ¶
type Variables interface { ListVariables() ([]efi.VariableDescriptor, error) GetVariable(guid efi.GUID, name string) (data []byte, attrs efi.VariableAttributes, err error) SetVariable(guid efi.GUID, name string, data []byte, attrs efi.VariableAttributes) error NewFileDevicePath(filepath string, mode efi_linux.FileDevicePathMode) (efi.DevicePath, error) DelVariable(guid efi.GUID, name string) error }
Variables abstracts away the host-specific bits of the efivars module