Version: v0.0.0-...-c97c800 Latest Latest

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

Go to latest
Published: Feb 6, 2019 License: BSD-3-Clause Imports: 17 Imported by: 0



Multiboot header as defined in

Multiboot info as defined in

Package multiboot implements basic primitives to load multiboot kernels as defined in



View Source
const DebugPrefix = "MULTIBOOT_DEBUG_INFO:"


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


func Probe

func Probe(file string) error

Probe checks if file is multiboot v1 kernel.


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 Flag

type Flag uint32
type Header struct {
	// contains filtered or unexported fields

Header represents a Multiboot v1 header loaded from the file.

type Info

type Info struct {
	Flags    Flag
	MemLower uint32
	MemUpper uint32

	// BootDevice is not supported, always zero.
	BootDevice uint32

	CmdLine uint32

	ModsCount uint32
	ModsAddr  uint32

	// Syms is not supported, always zero array.
	Syms [4]uint32

	MmapLength uint32
	MmapAddr   uint32

	DriversLength uint32
	DrivesrAddr   uint32

	ConfigTable uint32

	BootLoaderName uint32

	APMTable uint32

	VBEControlInfo  uint32
	VBEModeInfo     uint32
	VBEMode         uint16
	VBEInterfaceSeg uint16
	VBEInterfaceOff uint16
	VBEInterfaceLen uint16

	FramebufferAddr   uint16
	FramebufferPitch  uint16
	FramebufferWidth  uint32
	FramebufferHeight uint32
	FramebufferBPP    byte
	FramebufferType   byte
	ColorInfo         [6]byte

Info represents the Multiboot v1 info passed to the loaded kernel.

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) UnmarshalJSON

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

UnmarshalJSON implements json.Unmarshaler

type Module

type Module struct {
	// Start is the inclusive start of the Module memory location
	Start uint32
	// End is the exclusive end of the Module memory location.
	End uint32

	// CmdLine is a pointer to a null-terminated ASCII string.
	CmdLine uint32

	// Reserved is always zero.
	Reserved uint32

A Module represents a module to be loaded along with the kernel.

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.

type Multiboot

type Multiboot struct {

	// EntryPoint is a pointer to trampoline.
	EntryPoint uintptr
	// contains filtered or unexported fields

Multiboot defines parameters for working with multiboot kernels.

func New

func New(file, cmdLine, trampoline string, modules []string) *Multiboot

New returns a new Multiboot instance.

func (Multiboot) Description

func (m Multiboot) Description() (string, error)

Description returns string representation of multiboot information.

func (*Multiboot) Load

func (m *Multiboot) Load(debug bool) error

Load loads and parses multiboot information from m.file.

func (Multiboot) Segments

func (m Multiboot) Segments() []kexec.Segment

Segments returns kexec.Segments, where all the multiboot related information is stored.


Path Synopsis
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