build

package
v0.0.0-...-b4fbdbd Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: Apache-2.0 Imports: 31 Imported by: 62

Documentation

Overview

Package build contains helper functions for building kernels/images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(params Params) error

func LinuxKernelImage

func LinuxKernelImage(arch string) string

func LinuxMakeArgs

func LinuxMakeArgs(target *targets.Target, compiler, linker, ccache, buildDir string, jobs int) []string

Types

type BuildParams

type BuildParams struct {
	BuildScript      string   `json:"build_script"`
	EnvVars          []string `json:"env_vars"`
	Flags            []string `json:"flags"`
	AdditionalImages []string `json:"additional_images"`
	AutoconfPath     string   `json:"autoconf_path"`
	ConfigPath       string   `json:"config_path"`
}

type ImageDetails

type ImageDetails struct {
	Signature  string
	CompilerID string
}

Information that is returned from the Image function.

func Image

func Image(params Params) (details ImageDetails, err error)

Image creates a disk image for the specified OS/ARCH/VM. Kernel is taken from KernelDir, userspace system is taken from UserspaceDir. If CmdlineFile is not empty, contents of the file are appended to the kernel command line. If SysctlFile is not empty, contents of the file are appended to the image /etc/sysctl.conf. Output is stored in OutputDir and includes (everything except for image is optional):

  • image: the image
  • key: ssh key for the image
  • kernel: kernel for injected boot
  • initrd: initrd for injected boot
  • kernel.config: actual kernel config used during build
  • obj/: directory with kernel object files (this should match KernelObject specified in sys/targets, e.g. vmlinux for linux)

The returned structure contains a kernel ID that will be the same for kernels with the same runtime behavior, and different for kernels with different runtime behavior. Binary equal builds, or builds that differ only in e.g. debug info, have the same ID. The ID may be empty if OS implementation does not have a way to calculate such IDs. Also that structure provides a compiler ID field that contains the name and the version of the compiler/toolchain that was used to build the kernel. The CompilerID field is not guaranteed to be non-empty.

type InfraError

type InfraError struct {
	Title  string
	Output []byte
}

func (InfraError) Error

func (e InfraError) Error() string

type KernelError

type KernelError struct {
	Report     []byte
	Output     []byte
	Recipients vcs.Recipients
	// contains filtered or unexported fields
}

func (*KernelError) Error

func (err *KernelError) Error() string

type Params

type Params struct {
	TargetOS     string
	TargetArch   string
	VMType       string
	KernelDir    string
	OutputDir    string
	Compiler     string
	Make         string
	Linker       string
	Ccache       string
	UserspaceDir string
	CmdlineFile  string
	SysctlFile   string
	Config       []byte
	Tracer       debugtracer.DebugTracer
	BuildCPUs    int // If 0, all CPUs will be used.
	Build        json.RawMessage
}

Params is input arguments for the Image and Clean functions.

Jump to

Keyboard shortcuts

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