Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRamfs = cpio.ArchiveFromRecords([]cpio.Record{ cpio.Directory("tcz", 0755), cpio.Directory("etc", 0755), cpio.Directory("dev", 0755), cpio.Directory("tmp", 0777), cpio.Directory("ubin", 0755), cpio.Directory("usr", 0755), cpio.Directory("usr/lib", 0755), cpio.Directory("var/log", 0777), cpio.Directory("lib64", 0755), cpio.Directory("bin", 0755), cpio.CharDev("dev/console", 0600, 5, 1), cpio.CharDev("dev/tty", 0666, 5, 0), cpio.CharDev("dev/null", 0666, 1, 3), cpio.CharDev("dev/port", 0640, 1, 4), cpio.CharDev("dev/urandom", 0666, 1, 9), cpio.StaticFile("etc/resolv.conf", nameserver, 0644), cpio.StaticFile("etc/localtime", gmt0, 0644), })
DefaultRamfs are files that are contained in all u-root initramfs archives by default.
Functions ¶
func CreateInitramfs ¶
CreateInitramfs creates an initramfs built to opts' specifications.
func ParseExtraFiles ¶
func ParseExtraFiles(logger *log.Logger, archive *initramfs.Files, extraFiles []string, lddDeps bool) error
ParseExtraFiles adds files from the extraFiles list to the archive.
The following formats are allowed in the extraFiles list:
- `hostPath:archivePath` adds the file from hostPath at the relative archivePath in the archive.
- `justAPath` is added to the archive under justAPath.
ParseExtraFiles will also add ldd-listed dependencies if lddDeps is true.
func ResolvePackagePaths ¶
ResolvePackagePaths takes a list of Go package import paths and directories and turns them into exclusively import paths.
Currently allowed formats:
- package imports; e.g. github.com/u-root/u-root/cmds/ls
- globs of package imports, e.g. github.com/u-root/u-root/cmds/*
- paths to package directories; e.g. $GOPATH/src/github.com/u-root/u-root/cmds/ls
- globs of paths to package directories; e.g. ./cmds/*
Directories may be relative or absolute, with or without globs. Globs are resolved using filepath.Glob.
Types ¶
type Commands ¶
type Commands struct { // Builder is the Go compiler mode. Builder builder.Builder // Packages are the Go packages to compile and add to the archive. // // Currently allowed formats: // // - package imports; e.g. github.com/u-root/u-root/cmds/ls // - globs of package imports; e.g. github.com/u-root/u-root/cmds/* // - paths to package directories; e.g. $GOPATH/src/github.com/u-root/u-root/cmds/ls // - globs of paths to package directories; e.g. ./cmds/* // // Directories may be relative or absolute, with or without globs. // Globs are resolved using filepath.Glob. Packages []string // BinaryDir is the directory in which the resulting binaries are // placed inside the initramfs. // // BinaryDir may be empty, in which case Builder.DefaultBinaryDir() // will be used. BinaryDir string }
Commands specifies a list of Golang packages to build with a builder, e.g. in busybox mode or source mode or binary mode.
See Builder for an explanation of build modes.
type Opts ¶
type Opts struct { // Env is the Golang build environment (GOOS, GOARCH, etc). Env golang.Environ // Commands specify packages to build using a specific builder. // // E.g. the following will build 'ls' and 'ip' in busybox mode, but // 'cd' and 'cat' as separate binaries. 'cd', 'cat', 'bb', and symlinks // from 'ls' and 'ip' will be added to the final initramfs. // // []Commands{ // Commands{ // Builder: builder.BusyBox, // Packages: []string{ // "github.com/u-root/u-root/cmds/ls", // "github.com/u-root/u-root/cmds/ip", // }, // }, // Commands{ // Builder: builder.Binary, // Packages: []string{ // "github.com/u-root/u-root/cmds/cd", // "github.com/u-root/u-root/cmds/cat", // }, // }, // } Commands []Commands // TempDir is a temporary directory for builders to store files in. TempDir string // ExtraFiles are files to add to the archive in addition to the Go // packages. // // Shared library dependencies will automatically also be added to the // archive using ldd. // // The following formats are allowed in the list: // // - `hostPath:archivePath` adds the file from hostPath at the relative // archivePath in the archive. // - `justAPath` is added to the archive under justAPath. ExtraFiles []string // OutputFile is the archive output file. OutputFile initramfs.Writer // BaseArchive is an existing initramfs to include in the resulting // initramfs. BaseArchive initramfs.Reader // UseExistingInit determines whether the existing init from // BaseArchive should be used. // // If this is false, the "init" from BaseArchive will be renamed to // "inito". UseExistingInit bool // InitCmd is the name of a command to link /init to. // // This can be an absolute path or the name of a command included in // Commands. // // If this is empty, no init symlink will be created. InitCmd string // DefaultShell is the default shell to start after init. // // This can be an absolute path or the name of a command included in // Commands. // // This must be specified to have a default shell. DefaultShell string }
Opts are the arguments to CreateInitramfs.
Opts contains everything that influences initramfs creation such as the Go build environment.
Directories ¶
Path | Synopsis |
---|---|
test
|
|
Package util contains various u-root utility functions.
|
Package util contains various u-root utility functions. |