rapidos

package
v0.0.0-...-4e538cc Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddManifest

func AddManifest(m Manifest)

XXX this is called by manifest init() functions, so should panic on error.

func Boot

func Boot(conf *RapidosConf, imgPath string, pidsDir string) error

func Cut

func Cut(conf *RapidosConf, m *Manifest, rdir string,
	imgPath string) error

func FindBins

func FindBins(binNames []string, ignoreMissing bool) ([]string, error)

func FindKmods

func FindKmods(conf *RapidosConf, kmodNames []string) ([]string, error)

func IterateManifests

func IterateManifests(cb func(m Manifest))

func RenderManifest

func RenderManifest(conf RapidosConf, m *Manifest) error

finalize inventory for manifest based on current conf

func ValidateMemStr

func ValidateMemStr(mem string) error

parse Number with M/m or G/g suffix

Types

type Inventory

type Inventory struct {
	// init package runs immediately following boot..
	// The stock u-root init process is responsible for invoking the "uinit"
	// provided with a given manifest
	Init string
	// Additional go packages to install in the initramfs
	Pkgs []string
	// kernel modules required by this init
	Kmods []string
	// Binaries to locate via PATH (and sbin). The initramfs destination
	// will match the local source, with ldd dependencies also pulled in.
	Bins []string
	// files to include in the initramfs image. ldd dependencies will be
	// automatically pulled in alongside binaries.
	// Files will be placed in the same path as the local source by default.
	// The initramfs destination path can be explicitly specified via:
	// <local source>:<initramfs dest>
	// TODO use u-root/cmds/which to locate bins under PATH (+sbin)
	Files []string
}

type KmodsInfo

type KmodsInfo struct {
	KernelInstModPath string
	KernelVersion     string
}

type Manifest

type Manifest struct {
	// Name of init back-end
	Name string
	// short description of what this image does
	Descr string
	// u-root builder type. "bb" (default), "binary" or "source"
	Builder string

	// inventory includes a list of all image dependencies
	Inventory Inventory

	// optional callback which can update Inventory based on the provided
	// config.
	InventoryCB func(RapidosConf, *Inventory) error

	// VMResources are different from the rest of the Manifest in that they are
	// considered at VM boot time.
	VMResources Resources
}

func LookupManifest

func LookupManifest(name string) *Manifest

type RapidosConf

type RapidosConf struct {

	// command line
	Debug bool
	// contains filtered or unexported fields
}

func ParseConf

func ParseConf(confPath string, overlay map[string]string,
	debug bool) (*RapidosConf, error)

Parse confPath as an ini/shell env and return the resulting RapidosConf struct

func (*RapidosConf) DumpConf

func (conf *RapidosConf) DumpConf()

func (*RapidosConf) GenGob

func (conf *RapidosConf) GenGob() (*bytes.Buffer, error)

func (*RapidosConf) GetDirPath

func (conf *RapidosConf) GetDirPath(key string) (string, error)

func (*RapidosConf) GetKernImgPath

func (conf *RapidosConf) GetKernImgPath() (string, error)

func (*RapidosConf) GetKmodsInfo

func (conf *RapidosConf) GetKmodsInfo() (*KmodsInfo, error)

func (*RapidosConf) GetQEMUExtraArgs

func (conf *RapidosConf) GetQEMUExtraArgs() ([]string, error)

func (*RapidosConf) GetVMDef

func (conf *RapidosConf) GetVMDef(vmIndex int) (*RapidosConfVM, error)

type RapidosConfVM

type RapidosConfVM struct {
	TapDev  string
	MACAddr string
	UseDHCP bool
	// following could be empty if UseDHCP is true
	IPAddr   string
	Hostname string
}

type Resources

type Resources struct {
	// Whether the VM should be connected to the Rapidos bridge network
	Network bool
	// Number of SMP virtual CPUs to assign to the VM (QEMU uses a single
	// vCPU by default).
	CPUs uint8
	// Amount of memory to assign to the VM (use QEMU default when not set).
	// This value is MiB by default, but can be specified with an explicit
	// M or G suffix
	Memory string
}

func (*Resources) Apply

func (resc *Resources) Apply(imgPath string) error

store the Resources state as xattrs on @imgPath XXX intentionally use the "user.rapido." namespace, to remain compatible with github.com/rapido-linux

func (*Resources) Retrieve

func (resc *Resources) Retrieve(imgPath string) error

restore Resources state based on @imgPath xattrs XXX intentionally use the "user.rapido." namespace, to remain compatible with github.com/rapido-linux

Jump to

Keyboard shortcuts

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