bootconfig

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentManifestVersion = 1
)

global variables

Functions

This section is empty.

Types

type BootConfig

type BootConfig struct {
	Name          string   `json:"name,omitempty"`
	Kernel        string   `json:"kernel"`
	Initramfs     string   `json:"initramfs,omitempty"`
	KernelArgs    string   `json:"kernel_args,omitempty"`
	DeviceTree    string   `json:"devicetree,omitempty"`
	Multiboot     string   `json:"multiboot_kernel,omitempty"`
	MultibootArgs string   `json:"multiboot_args,omitempty"`
	Modules       []string `json:"multiboot_modules,omitempty"`
}

BootConfig is a general-purpose boot configuration. It draws some characteristics from FIT but it's not compatible with it. It uses JSON for interoperability.

func NewBootConfig

func NewBootConfig(data []byte) (*BootConfig, error)

NewBootConfig parses a boot configuration in JSON format and returns a BootConfig object.

func (*BootConfig) Boot

func (bc *BootConfig) Boot() error

Boot tries to boot the kernel with optional initramfs and command line options. If a device-tree is specified, that will be used too

func (*BootConfig) IsValid

func (bc *BootConfig) IsValid() bool

IsValid returns true if a BootConfig object has valid content, and false otherwise

type Manifest

type Manifest struct {
	// Version is a positive integer that determines the version of the Manifest
	// structure. This will be used when introducing breaking changes in the
	// Manifest interface.
	Version int          `json:"version"`
	Configs []BootConfig `json:"configs"`
}

Manifest is a list of BootConfig objects. The goal is to provide multiple configurations to choose from.

func FromZip

func FromZip(filename string, pubkeyfile *string) (*Manifest, string, error)

FromZip tries to extract a boot configuration from a ZIP file after verifying its signature with the provided public key file. The signature is expected to be appended to the ZIP file and have fixed length `ed25519.SignatureSize` . The returned string argument is the temporary directory where the files were extracted, if successful. No decoder (e.g. JSON, ZIP) or other function parsing the input file is called before verifying the signature.

func ManifestFromBytes

func ManifestFromBytes(data []byte) (*Manifest, error)

ManifestFromBytes parses a manifest configuration, i.e. a list of boot configurations, in JSON format and returns a Manifest object.

func NewManifest

func NewManifest() *Manifest

NewManifest returns a new empty Manifest structure with the current version field populated.

func (*Manifest) GetBootConfig

func (mc *Manifest) GetBootConfig(idx int) (*BootConfig, error)

GetBootConfig returns the i-th boot configuration from the manifest, or an error if an invalid index is passed.

Jump to

Keyboard shortcuts

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