initrd

package
v0.9.2-32-g5cc772a5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: BSD-3-Clause Imports: 44 Imported by: 1

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Package initrd is a package that is used for the dynamic construction of CPIO archives which are used as initramfs for a unikernel instance.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2024, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2024, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const (
	// DefaultInitramfsFileName is the default filename used when creating or
	// serializing a CPIO archive.
	DefaultInitramfsFileName = "initramfs.cpio"

	// DefaultInitramfsArchFileName is the default filename used when creating
	// or serializing a CPIO archive based on a specific architecture
	DefaultInitramfsArchFileName = "initramfs-%s.cpio"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Initrd added in v0.7.0

type Initrd interface {
	// Name of the initramfs builder.
	Name() string

	// Build the rootfs and return the location of the result or error.
	Build(context.Context) (string, error)

	// All environment variables that are set within.
	Env() []string

	// All arguments that are passed to the initramfs.
	Args() []string
}

Initrd is an interface that is used to allow for different underlying implementations to construct a CPIO archive.

func New added in v0.7.0

func New(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error)

New attempts to return the builder for a supplied path which will allow the provided ...

func NewFromDirectory added in v0.7.0

func NewFromDirectory(_ context.Context, dir string, opts ...InitrdOption) (Initrd, error)

NewFromDirectory returns an instantiated Initrd interface which is is able to serialize a rootfs from a given directory.

func NewFromDockerfile added in v0.7.0

func NewFromDockerfile(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error)

NewFromDockerfile accepts an input path which represents a Dockerfile that can be constructed via buildkit to become a CPIO archive.

func NewFromFile added in v0.6.0

func NewFromFile(_ context.Context, path string, opts ...InitrdOption) (Initrd, error)

NewFromFile accepts an input file which already represents a CPIO archive and is provided as a mechanism for satisfying the Initrd interface.

func NewFromOCIImage added in v0.8.7

func NewFromOCIImage(ctx context.Context, path string, opts ...InitrdOption) (Initrd, error)

NewFromOCIImage creates a new initrd from a remote container image.

type InitrdOption added in v0.7.0

type InitrdOption func(*InitrdOptions) error

func WithArchitecture added in v0.7.1

func WithArchitecture(arch string) InitrdOption

WithArchitecture sets the architecture of the file contents of binaries in the initramfs. Files may not always be architecture specific, this option simply indicates the target architecture if any binaries are compiled by the implementing initrd builder.

func WithCacheDir added in v0.7.0

func WithCacheDir(dir string) InitrdOption

WithCacheDir sets the path of an internal location that's used during the serialization of the initramfs as a mechanism for storing temporary files used as cache.

func WithCompression added in v0.8.0

func WithCompression(compress bool) InitrdOption

WithCompression sets the compression of the resulting CPIO archive file.

func WithOutput added in v0.7.0

func WithOutput(output string) InitrdOption

WithOutput sets the location of the output location of the resulting CPIO archive file.

func WithWorkdir added in v0.8.7

func WithWorkdir(dir string) InitrdOption

WithWorkdir sets the working directory of the initramfs builder. This is used as a mechanism for storing temporary files and directories during the serialization of the initramfs.

type InitrdOptions added in v0.7.0

type InitrdOptions struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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