exec

package
v0.0.0-...-27eb9ae Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: BSD-3-Clause Imports: 7 Imported by: 4

Documentation

Overview

Package exec provides support for kernel image loading and booting in bare metal Go applications.

This package is only meant to be used with `GOOS=tamagom` as supported by the TamaGo framework for bare metal Go, see https://github.com/usbarmory/tamago.

Index

Constants

View Source
const (
	VideoTypeEFI   = 0x70
	Video64BitBase = 1 << 1
)

Screen information https://github.com/torvalds/linux/blob/master/include/uapi/linux/screen_info.h

View Source
const (
	MinProtocolVersion = 0x0205 // https://docs.kernel.org/arch/x86/boot.html
)

Linux kernel information https://docs.kernel.org/arch/x86/boot.html

Variables

View Source
var (
	EFI64LoaderSignature = [4]byte{0x45, 0x4c, 0x36, 0x34} // "EL64"
	EFI32LoaderSignature = [4]byte{0x45, 0x4c, 0x33, 0x32} // "EL32"
)

EFI Information (efi_info) signatures

Functions

This section is empty.

Types

type BootImage

type BootImage interface {
	Load() error
	Entry() uint
	Boot(cleanup func()) error
}

BootImage represents a bootable image.

type EFI

type EFI struct {
	LoaderSignature   [4]byte
	SystemTable       uint32
	MemoryDescSize    uint32
	MemoryDescVersion uint32
	MemoryMap         uint32
	MemoryMapSize     uint32
	SystemTableHigh   uint32
	MemoryMapHigh     uint32
}

EFI represents the Linux Zero Page `efi_info` structure.

func (*EFI) MarshalBinary

func (d *EFI) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

type ELFImage

type ELFImage struct {
	// Region is the memory area for image loading.
	Region *dma.Region
	// ELF is a bootable bare-metal ELF image.
	ELF []byte
	// contains filtered or unexported fields
}

ELFImage represents a bootable bare-metal ELF image.

func (*ELFImage) Boot

func (image *ELFImage) Boot(cleanup func()) (err error)

Boot calls a loaded bare-metal ELF image.

func (*ELFImage) Entry

func (image *ELFImage) Entry() uint

Entry returns the image entry address.

func (*ELFImage) Load

func (image *ELFImage) Load() (err error)

Load loads a bare-metal ELF image in memory.

The ELF loader is _very_ simple, suitable for loading unikernels like those produced by TamaGo.

type LinuxImage

type LinuxImage struct {
	// Region is the memory area for image loading.
	Region *dma.Region
	// Memory is the system memory map
	Memory []bzimage.E820Entry

	// Kernel is the Linux kernel image.
	Kernel []byte
	// KernelOffset is the Linux kernel offset from RAM start address.
	KernelOffset int

	// BzImage is the kernel extracted by by Parse() or Load().
	BzImage *bzimage.BzImage

	// InitialRamDisk is the Linux kernel initrd file.
	InitialRamDisk []byte
	// InitialRamDiskOffset is the initrd offset from RAM start address.
	InitialRamDiskOffset int

	// CmdLine is the Linux kernel command line arguments.
	CmdLine string
	// CmdLineOffset is the command line offset from RAM start address.
	CmdLineOffset int

	// ParamsOffset is the boot parameters offset from RAM start address.
	ParamsOffset int

	// EFI is the boot parameters EFI information.
	EFI *EFI
	// Screen is the boot parameters frame buffer information.
	Screen *Screen
	// contains filtered or unexported fields
}

LinuxImage represents a bootable Linux kernel image.

func (*LinuxImage) Boot

func (image *LinuxImage) Boot(cleanup func()) (err error)

Boot calls a loaded Linux kernel image.

func (*LinuxImage) Entry

func (image *LinuxImage) Entry() uint

Entry returns the image entry address.

func (*LinuxImage) Load

func (image *LinuxImage) Load() (err error)

Load loads a Linux kernel image in memory.

func (*LinuxImage) Parse

func (image *LinuxImage) Parse() (err error)

type Screen

type Screen struct {
	OrigX         uint8
	OrigY         uint8
	ExtMemK       uint16
	OrigVideoPage uint16
	OrigVideoMode uint8
	OrigVideoCols uint8

	OrigVideoeGabx uint16

	OrigVideoLines  uint8
	OrigVideoIsVGA  uint8
	OrigVideoPoints uint16
	LfbWidth        uint16
	LfbHeight       uint16
	LfbDepth        uint16
	LfbBase         uint32
	LfbSize         uint32
	CLMagic         uint16
	CLOffset        uint16
	LfbLineLength   uint16
	RedSize         uint8
	RedPos          uint8
	GreenSize       uint8
	GreenPos        uint8
	BlueSize        uint8
	BluePos         uint8
	RsvdSize        uint8
	RsvdPos         uint8
	VesapmSeg       uint16
	VesapmOff       uint16
	Pages           uint16
	VesaAttributes  uint16
	Capabilities    uint32
	ExtLfbBase      uint32
	// contains filtered or unexported fields
}

Screen represents the Linux Zero Page `screen_info` structure.

func (*Screen) MarshalBinary

func (d *Screen) MarshalBinary() (data []byte, err error)

MarshalBinary implements the encoding.BinaryMarshaler interface.

Jump to

Keyboard shortcuts

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