libinit

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: BSD-3-Clause Imports: 16 Imported by: 26

Documentation

Overview

Package libinit creates the environment and root file system for u-root.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(bin string, m ...CommandModifier) *exec.Cmd

Command constructs an *exec.Cmd object.

func CreateRootfs

func CreateRootfs()

CreateRootfs creates the default u-root file system.

func GetModulesFromCmdline added in v0.10.0

func GetModulesFromCmdline(m *InitModuleLoader) ([]string, error)

GetModulesFromCmdline finds kernel modules from the modules_load kernel parameter

func GetModulesFromConf added in v0.10.0

func GetModulesFromConf(pattern string) ([]string, error)

GetModulesFromConf finds kernel modules from .conf files in /lib/modules-load.d/

func InstallAllModules

func InstallAllModules() error

InstallAllModules installs kernel modules form the following locations in order: - .ko files from /lib/modules - modules found in .conf files from /lib/modules-load.d/ - modules found in the cmdline argument modules_load= separated by , Useful for modules that need to be loaded for boot (ie a network driver needed for netboot). It skips over blacklisted modules in excludedMods.

func InstallModules

func InstallModules(m *InitModuleLoader, modules []string)

InstallModules installs the passed modules using the InitModuleLoader

func InstallModulesFromDir added in v0.10.0

func InstallModulesFromDir(pattern string, loader *InitModuleLoader) error

InstallModulesFromDir installs kernel modules (.ko files) from /lib/modules that match the given pattern, skipping those in the exclude list.

func NetInit

func NetInit()

NetInit is u-root network initialization.

func RunCommands

func RunCommands(debug func(string, ...interface{}), commands ...*exec.Cmd) int

FIX ME: make it not linux-specific RunCommands runs commands in sequence.

RunCommands returns how many commands existed and were attempted to run.

commands must refer to absolute paths at the moment.

func SetEnv

func SetEnv()

SetEnv sets the default u-root environment.

func WaitOrphans

func WaitOrphans() uint

WaitOrphans waits for all remaining processes on the system to exit.

Types

type CommandModifier

type CommandModifier func(c *exec.Cmd)

CommandModifier makes *exec.Cmd construction modular.

func WithArguments

func WithArguments(arg ...string) CommandModifier

WithArguments adds command-line arguments to a command.

func WithCloneFlags

func WithCloneFlags(flags uintptr) CommandModifier

WithCloneFlags adds clone(2) flags to the *exec.Cmd.

func WithTTYControl

func WithTTYControl(ctty bool) CommandModifier

WithTTYControl turns on controlling the TTY on this command.

type InitModuleLoader added in v0.10.0

type InitModuleLoader struct {
	Cmdline      *cmdline.CmdLine
	Prober       func(name string, modParameters string) error
	ExcludedMods map[string]bool
}

InitModuleLoader wraps the resources we need for early module loading

func NewInitModuleLoader added in v0.10.0

func NewInitModuleLoader() *InitModuleLoader

func (*InitModuleLoader) IsExcluded added in v0.10.0

func (i *InitModuleLoader) IsExcluded(mod string) bool

func (*InitModuleLoader) LoadModule added in v0.10.0

func (i *InitModuleLoader) LoadModule(mod string) error

Jump to

Keyboard shortcuts

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