boot

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: 203

Documentation

Overview

Package boot is the high-level interface for booting another operating system from Linux using kexec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CatInitrds

func CatInitrds(initrds ...io.ReaderAt) io.ReaderAt

CatInitrds concatenates initrds on first ReadAt call from a list of io.ReaderAts, pads them to a 512 byte boundary.

func CreateInitrd added in v0.9.0

func CreateInitrd(files ...string) (io.ReaderAt, error)

CreateInitrd creates an initrd with the collection of files passed in.

func Execute

func Execute() error

Execute executes a previously loaded OSImage.

This will only work if OSImage.Load was called on some OSImage.

Types

type LinuxImage

type LinuxImage struct {
	Name string

	Kernel      io.ReaderAt
	Initrd      io.ReaderAt
	Cmdline     string
	BootRank    int
	LoadSyscall bool

	KexecOpts linux.KexecOptions
}

LinuxImage implements OSImage for a Linux kernel + initramfs.

func (*LinuxImage) Edit

func (li *LinuxImage) Edit(f func(cmdline string) string)

Edit the kernel command line.

func (*LinuxImage) Label

func (li *LinuxImage) Label() string

Label returns either the Name or a short description.

func (*LinuxImage) Load

func (li *LinuxImage) Load(verbose bool) error

Load implements OSImage.Load and kexec_load's the kernel with its initramfs.

func (*LinuxImage) Rank

func (li *LinuxImage) Rank() int

Rank for the boot menu order

func (*LinuxImage) String

func (li *LinuxImage) String() string

String prints a human-readable version of this linux image.

type LoadedLinuxImage added in v0.10.0

type LoadedLinuxImage struct {
	Name        string
	Kernel      *os.File
	Initrd      *os.File
	Cmdline     string
	LoadSyscall bool
	KexecOpts   linux.KexecOptions
}

LoadedLinuxImage is a processed version of LinuxImage.

Main difference being that kernel and initrd is made as a read-only *os.File. There is also additional processing such as DTB, if available under KexecOpts, will be appended to Initrd.

type MultibootImage

type MultibootImage struct {
	Name string

	Kernel   io.ReaderAt
	Cmdline  string
	Modules  []multiboot.Module
	IBFT     *ibft.IBFT
	BootRank int
}

MultibootImage is a multiboot-formated OSImage, such as ESXi, Xen, Akaros, tboot.

func (*MultibootImage) Edit

func (mi *MultibootImage) Edit(f func(cmdline string) string)

Edit the kernel command line.

func (*MultibootImage) Label

func (mi *MultibootImage) Label() string

Label returns either Name or a short description.

func (*MultibootImage) Load

func (mi *MultibootImage) Load(verbose bool) error

Load implements OSImage.Load.

func (*MultibootImage) Rank

func (mi *MultibootImage) Rank() int

Rank for the boot menu order

func (*MultibootImage) String

func (mi *MultibootImage) String() string

String implements fmt.Stringer.

type OSImage

type OSImage interface {
	fmt.Stringer

	// Label is a name or short description for this OSImage.
	//
	// Label is intended for boot menus.
	Label() string

	// Rank the priority of the images for boot menus.
	//
	// The larger the number, the prior the image shows in the menu.
	Rank() int

	// Edit the kernel command line if possible. Must be called before
	// Load.
	Edit(func(cmdline string) string)

	// Load loads the OS image into kernel memory, ready for execution.
	//
	// After Load is called, call boot.Execute() to stop Linux and boot the
	// loaded OSImage.
	Load(verbose bool) error
}

OSImage represents a bootable OS package.

Directories

Path Synopsis
Package bls parses systemd Boot Loader Spec config files.
Package bls parses systemd Boot Loader Spec config files.
Package bootcmd handles common cleanup functions and flags that all boot commands should support.
Package bootcmd handles common cleanup functions and flags that all boot commands should support.
Package boottest contains methods for comparing boot.OSImages to each other and to JSON representations of themselves for use in tests.
Package boottest contains methods for comparing boot.OSImages to each other and to JSON representations of themselves for use in tests.
Package bzimage implements decoding for bzImage files.
Package bzimage implements decoding for bzImage files.
Package ebda looks for the Extended Bios Data Area (EBDA) pointer in /dev/mem, and provides access to the EBDA.
Package ebda looks for the Extended Bios Data Area (EBDA) pointer in /dev/mem, and provides access to the EBDA.
Package esxi contains an ESXi boot config parser for disks and CDROMs.
Package esxi contains an ESXi boot config parser for disks and CDROMs.
Package fit provides tools to read and verify FIT kernel images See https://doc.coreboot.org/lib/payloads/fit.html
Package fit provides tools to read and verify FIT kernel images See https://doc.coreboot.org/lib/payloads/fit.html
Package grub implements a grub config file parser.
Package grub implements a grub config file parser.
Package ibft defines the iSCSI Boot Firmware Table.
Package ibft defines the iSCSI Boot Firmware Table.
Package image contains a parser for Arm64 Linux Image format.
Package image contains a parser for Arm64 Linux Image format.
Package kexec implements kexec load and file load syscall API.
Package kexec implements kexec load and file load syscall API.
The linux package loads bzImage-based Linux kernels using the kexec_load system call.
The linux package loads bzImage-based Linux kernels using the kexec_load system call.
Package localboot contains helper functions for booting off local disks.
Package localboot contains helper functions for booting off local disks.
Package menu displays a Terminal UI based text menu to choose boot options from.
Package menu displays a Terminal UI based text menu to choose boot options from.
Package multiboot implements bootloading multiboot kernels as defined by https://www.gnu.org/software/grub/manual/multiboot/multiboot.html.
Package multiboot implements bootloading multiboot kernels as defined by https://www.gnu.org/software/grub/manual/multiboot/multiboot.html.
internal/trampoline
Package trampoline sets machine to a specific state defined by multiboot v1 spec and jumps to the intended kernel.
Package trampoline sets machine to a specific state defined by multiboot v1 spec and jumps to the intended kernel.
Package netboot provides a one-stop shop for netboot parsing needs.
Package netboot provides a one-stop shop for netboot parsing needs.
ipxe
Package ipxe implements a trivial IPXE config file parser.
Package ipxe implements a trivial IPXE config file parser.
pxe
Package pxe implements the PXE config file parsing.
Package pxe implements the PXE config file parsing.
Package purgatory provides several purgatories for use with kexec_load system call.
Package purgatory provides several purgatories for use with kexec_load system call.
Package syslinux implements a syslinux config file parser.
Package syslinux implements a syslinux config file parser.
Package zbi contains a parser for the Zircon boot image format.
Package zbi contains a parser for the Zircon boot image format.
Package zimage contains a Parser for the arm zImage Linux format.
Package zimage contains a Parser for the arm zImage Linux format.

Jump to

Keyboard shortcuts

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