Documentation
¶
Overview ¶
Package initramfs provides functions for building the initramfs for virtrun. The initramfs is a CPIO archive that is written into a temporary file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitProgFor ¶ added in v0.15.3
InitProgFor returns the pre-built init executable for the given architecture.
The init binary is supposed to set up the system and execute the file "/main".
func WriteToTempFile ¶ added in v0.15.3
WriteToTempFile writes the fs.FS as CPIO archive into a new temporary file with the given prefix and returns the absolute path to this file.
If the given dir name is not empty, the file is created in this directory. Otherwise the default tempdir is used. See os.CreateTemp.
Types ¶
type FS ¶ added in v0.12.0
FS is a virtual file system tree that represents the initramfs.
func New ¶
New creates a new initramfs CPIO archive file.
The archive consists of a main executable that is either executed directly or by the init program. All other files are added to the dataDir directory. Kernel modules are added to modulesDir directory. For all ELF files the dynamically linked shared objects are collected and added to the libsDir directory. The paths to the directories they have been found at are added as symlinks to the libsDir directory as well.
type Spec ¶ added in v0.15.3
type Spec struct {
// Executable is the main binary that is either executed directly or by the
// init program depending on the presence of [Initramfs.Init].
Executable string
// Files is a list of any additional files that should be added to the
// dataDir directory. For ELF files the required dynamic libraries are
// added the libsDir directory.
Files []string
// Modules is a list of kernel module files. They are added to the
// modulesDir directory.
Modules []string
// Fsys is the file system all files should be copied from.
Fsys fs.FS
// Init provides the init program. If not set, the [Initramfs.Executable] is
// used as init program itself and expected to handle system setup and clean
// shutdown.
Init fs.File
}
Spec specifies the input for initramfs archive creation.