multiboot

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: 19 Imported by: 0

Documentation

Overview

Multiboot header as defined in https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Header-layout

Multiboot info as defined in https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format

Package multiboot implements bootloading multiboot kernels as defined by https://www.gnu.org/software/grub/manual/multiboot/multiboot.html.

Package multiboot crafts kexec segments that can be used with the kexec_load system call.

Index

Constants

View Source
const DebugPrefix = "MULTIBOOT_DEBUG_INFO:"

Variables

View Source
var ErrFlagsNotSupported = errors.New("multiboot header flags not supported yet")
View Source
var ErrHeaderNotFound = errors.New("multiboot header not found")
View Source
var (
	PageSize = os.Getpagesize()
)

Functions

func Load

func Load(debug bool, file, cmdline string, modules []string, ibft *ibft.IBFT) error

Load parses and loads a multiboot kernel `file` using kexec_load.

Each module is a path followed by optional command-line arguments, e.g. []string{"./module arg1 arg2", "./module2 arg3 arg4"}.

debug turns on debug logging.

Load can set up an arbitrary number of modules, and takes care of the multiboot info structure, including the memory map.

After Load is called, kexec.Reboot() is ready to be called any time to stop Linux and execute the loaded kernel.

func Probe

func Probe(file string) error

Probe checks if file is multiboot v1 kernel.

Types

type Description

type Description struct {
	Status string `json:"status"`

	Flags      uint32 `json:"flags"`
	MemLower   uint32 `json:"mem_lower"`
	MemUpper   uint32 `json:"mem_upper"`
	MmapAddr   uint32 `json:"mmap_addr"`
	MmapLength uint32 `json:"mmap_length"`

	CmdLine    string `json:"cmdline"`
	Bootloader string `json:"bootloader"`

	Mmap    []MemoryMap  `json:"mmap"`
	Modules []ModuleDesc `json:"modules"`
}

Description stores representation of multiboot information passed to a final kernel used for for debugging and testing.

type MemoryMap

type MemoryMap struct {
	// Size is the size of the associated structure in bytes.
	Size uint32
	// BaseAddr is the starting address.
	BaseAddr uint64
	// Length is the size of the memory region in bytes.
	Length uint64
	// Type is the variety of address range represented.
	Type uint32
}

MemoryMap represents a reserved range of memory passed via the multiboot Info header.

func (MemoryMap) MarshalJSON

func (m MemoryMap) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (MemoryMap) String

func (m MemoryMap) String() string

String returns a readable representation of a MemoryMap entry.

func (*MemoryMap) UnmarshalJSON

func (m *MemoryMap) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type ModuleDesc

type ModuleDesc struct {
	Start   uint32 `json:"start"`
	End     uint32 `json:"end"`
	CmdLine string `json:"cmdline"`
	SHA256  string `json:"sha256"`
}

ModuleDesc is a debug representation of loaded module.

Directories

Path Synopsis
internal
trampoline
Trampoline sets machine to a specific state defined by multiboot v1 spec and boots the final kernel.
Trampoline sets machine to a specific state defined by multiboot v1 spec and boots the final kernel.

Jump to

Keyboard shortcuts

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