u-root

command module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: BSD-3-Clause Imports: 18 Imported by: 0

README

u-root

Build Status codecov Go Report Card GoDoc Slack License

Description

u-root embodies four different projects.

  • Go versions of many standard Linux tools, such as ls, cp, or shutdown. See cmds/core for most of these.

  • A way to compile many Go programs into a single binary with busybox mode.

  • A way to create initramfs (an archive of files) to use with Linux kernels.

  • Go bootloaders that use kexec to boot Linux or multiboot kernels such as ESXi, Xen, or tboot. They are meant to be used with LinuxBoot. With that, parsers for GRUB config files or syslinux config files are to make transition to LinuxBoot easier.

⚠ Go Path is deprecated in favor of filesystem paths ⚠

Since Go added modules in v1.11 it got increasingly difficult to determine where the source code actually ends up on the filesystem which caused a lot of confusion and breakages.

The new behavior of u-root is therefore to only accept absolute or relative filesystem paths for Go programs which should be added into the BusyBox. One exception are templates like core or shortcuts to u-root commands like cmds/core/ls. For those to still work we added a new flag called -uroot-source which expects the filesystem path of a local copy of the u-root repository. If you're invoking u-root inside the repository for example, it would look like ./u-root -uroot-source ./

Usage

Make sure your Go version is >=1.17.

Download and install u-root either via git:

git clone https://github.com/u-root/u-root
cd u-root
go build

The resulting binary will the be placed where go build was invoked

Or install directly with go:

go install github.com/u-root/u-root

Note: The u-root command will end up in $GOPATH/bin/u-root, so you may need to add $GOPATH/bin to your $PATH.

You can now use the u-root command to build an initramfs. Here are some examples with $UROOT_PATH being the path to where the u-root sources are on the disk (explicitly specifiying this is only necessary if not runnig u-root inside the root of the repository):

# Build an initramfs of all the Go cmds in ./cmds/core/... (default)
u-root

# Build an initramfs of all the Go cmds in ./cmds/core/...
# But running the command outside of the repository root
u-root -uroot-source $UROOT_PATH

# Generate an archive with bootloaders
#
# core and boot are templates that expand to sets of commands
u-root core boot

# Generate an archive with only these given commands
u-root ./cmds/core/{init,ls,ip,dhclient,wget,cat,elvish}

# Generate an archive with all of the core tools with some exceptions
u-root core -cmds/core/{ls,losetup}

# Generate an archive with a tool outside of u-root
git clone https://github.com/u-root/cpu
u-root ./cmds/core/{init,ls,elvish} ./cpu/cmds/cpud

The default set of packages included is all packages in https://github.com/u-root/u-root/cmds/core/....

You can build the initramfs built by u-root into the kernel via the CONFIG_INITRAMFS_SOURCE config variable or you can load it separately via an option in for example Grub or the QEMU command line or coreboot config variable.

Extra Files

You may also include additional files in the initramfs using the -files flag. If you add binaries with -files are listed, their ldd dependencies will be included as well. As example for Debian, you want to add two kernel modules for testing, executing your currently booted kernel:

NOTE: these files will be placed in the $HOME dir in the initramfs.

u-root -files "$HOME/hello.ko $HOME/hello2.ko"
qemu-system-x86_64 -kernel /boot/vmlinuz-$(uname -r) -initrd /tmp/initramfs.linux_amd64.cpio

To specify the location in the initramfs, use <sourcefile>:<destinationfile>. For example:

u-root -files "root-fs/usr/bin/runc:usr/bin/run"

Init and Uinit

u-root has a very simple (exchangable) init system controlled by the -initcmd and -uinitcmd command-line flags.

  • -initcmd determines what /init is symlinked to. -initcmd may be a u-root command name or a symlink target.
  • -uinitcmd is run by the default u-root init after some basic file system setup. There is no default, users should optionally supply their own. -uinitcmd may be a u-root command name with arguments or a symlink target with arguments.
  • After running a uinit (if there is one), init will start a shell determined by the -defaultsh argument.

We expect most users to keep their -initcmd as init, but to supply their own uinit for additional initialization or to immediately load another operating system.

All three command-line args accept both a u-root command name or a target symlink path. Only -uinitcmd accepts command-line arguments, however. For example,

u-root -uinitcmd="echo Go Gopher" ./cmds/core/{init,echo,elvish}

cpio -ivt < /tmp/initramfs.linux_amd64.cpio
# ...
# lrwxrwxrwx   0 root     root           12 Dec 31  1969 bin/uinit -> ../bbin/echo
# lrwxrwxrwx   0 root     root            9 Dec 31  1969 init -> bbin/init

qemu-system-x86_64 -kernel $KERNEL -initrd /tmp/initramfs.linux_amd64.cpio -nographic -append "console=ttyS0"
# ...
# [    0.848021] Freeing unused kernel memory: 896K
# 2020/05/01 04:04:39 Welcome to u-root!
#                              _
#   _   _      _ __ ___   ___ | |_
#  | | | |____| '__/ _ \ / _ \| __|
#  | |_| |____| | | (_) | (_) | |_
#   \__,_|    |_|  \___/ \___/ \__|
#
# Go Gopher
# ~/>

Passing command line arguments like above is equivalent to passing the arguments to uinit via a flags file in /etc/uinit.flags, see Extra Files.

Additionally, you can pass arguments to uinit via the uroot.uinitargs kernel parameters, for example:

u-root -uinitcmd="echo Gopher" ./cmds/core/{init,echo,elvish}

cpio -ivt < /tmp/initramfs.linux_amd64.cpio
# ...
# lrwxrwxrwx   0 root     root           12 Dec 31  1969 bin/uinit -> ../bbin/echo
# lrwxrwxrwx   0 root     root            9 Dec 31  1969 init -> bbin/init

qemu-system-x86_64 -kernel $KERNEL -initrd /tmp/initramfs.linux_amd64.cpio -nographic -append "console=ttyS0 uroot.uinitargs=Go"
# ...
# [    0.848021] Freeing unused kernel memory: 896K
# 2020/05/01 04:04:39 Welcome to u-root!
#                              _
#   _   _      _ __ ___   ___ | |_
#  | | | |____| '__/ _ \ / _ \| __|
#  | |_| |____| | | (_) | (_) | |_
#   \__,_|    |_|  \___/ \___/ \__|
#
# Go Gopher
# ~/>

Note the order of the passed arguments in the above example.

The command you name must be present in the command set. The following will not work:

u-root -uinitcmd="echo Go Gopher" ./cmds/core/{init,elvish}
# 2020/04/30 21:05:57 could not create symlink from "bin/uinit" to "echo": command or path "echo" not included in u-root build: specify -uinitcmd="" to ignore this error and build without a uinit

You can also refer to non-u-root-commands; they will be added as symlinks. We don't presume to know whether your symlink target is correct or not.

This will build, but not work unless you add a /bin/foobar to the initramfs.

u-root -uinitcmd="/bin/foobar Go Gopher" ./cmds/core/{init,elvish}

This will boot the same as the above.

u-root -uinitcmd="/bin/foobar Go Gopher" -files /bin/echo:bin/foobar ./cmds/core/{init,elvish}

This will bypass the regular u-root init and just launch a shell:

u-root -initcmd=elvish ./cmds/core/{elvish,ls}

cpio -ivt < /tmp/initramfs.linux_amd64.cpio
# ...
# lrwxrwxrwx   0 root     root            9 Dec 31  1969 init -> bbin/elvish

qemu-system-x86_64 -kernel $KERNEL -initrd /tmp/initramfs.linux_amd64.cpio -nographic -append "console=ttyS0"
# ...
# [    0.848021] Freeing unused kernel memory: 896K
# failed to put myself in foreground: ioctl: inappropriate ioctl for device
# ~/>

(It fails to do that because some initialization is missing when the shell is started without a proper init.)

Cross Compilation (targeting different architectures and OSes)

Cross-OS and -architecture compilation comes for free with Go. In fact, every PR to the u-root repo is built against the following architectures: amd64, x86 (i.e. 32bit), mipsle, armv7, arm64, and ppc64le.

Further, we run integration tests on linux/amd64, freebsd/amd64 and linux/arm64, using several CI systems. If you need to add another CI system, processor or OS, please let us know.

To cross compile for an ARM, on Linux:

GOARCH=arm u-root

If you are on OSX, and wish to build for Linux on AMD64:

GOOS=linux GOARCH=amd64 u-root

Testing in QEMU

A good way to test the initramfs generated by u-root is with qemu:

qemu-system-x86_64 -nographic -kernel path/to/kernel -initrd /tmp/initramfs.linux_amd64.cpio

Note that you do not have to build a special kernel on your own, it is sufficient to use an existing one. Usually you can find one in /boot.

If you quickly need to obtain a kernel, for example, when you are on a non-Linux system, you can assemble a URL to download one through Arch Linux's iPXE menu file. It would download from ${mirrorurl}iso/${release}/arch/boot/x86_64/vmlinuz-linux, so just search for a mirror URL you prefer and a release version, for example, http://mirror.rackspace.com/archlinux/iso/2022.05.01/arch/boot/x86_64/vmlinuz-linux.

Framebuffer

For framebuffer support, append a VESA mode via the vga kernel parameter:

qemu-system-x86_64 \
  -kernel path/to/kernel \
  -initrd /tmp/initramfs.linux_amd64.cpio \
  -append "vga=786"

For a list of modes, refer to the Linux kernel documentation.

Entropy / Random Number Generator

Some utilities, e.g., dhclient, require entropy to be present. For a speedy virtualized random number generator, the kernel should have the following:

CONFIG_VIRTIO_PCI=y
CONFIG_HW_RANDOM_VIRTIO=y
CONFIG_CRYPTO_DEV_VIRTIO=y

Then you can run your kernel in QEMU with a virtio-rng-pci device:

qemu-system-x86_64 \
    -device virtio-rng-pci \
    -kernel vmlinuz \
    -initrd /tmp/initramfs.linux_amd64.cpio

In addition, you can pass your host's RNG:

qemu-system-x86_64 \
    -object rng-random,filename=/dev/urandom,id=rng0 \
    -device virtio-rng-pci,rng=rng0 \
    -kernel vmlinuz \
    -initrd /tmp/initramfs.linux_amd64.cpio

SystemBoot

SystemBoot is a set of bootloaders written in Go. It is meant to be a distribution for LinuxBoot to create a system firmware + bootloader. All of these use kexec to boot. The commands are in cmds/boot.

  • pxeboot: a network boot client that uses DHCP and HTTP or TFTP to get a boot configuration which can be parsed as PXELinux or iPXE configuration files to get a boot program.

  • boot: finds all bootable kernels on local disk, shows a menu, and boots them. Supports (basic) GRUB, (basic) syslinux, (non-EFI) BootLoaderSpec, and ESXi configurations.

  • fbnetboot: a network boot client that uses DHCP and HTTP to get a boot program based on Linux, and boots it. To be merged with pxeboot.

  • localboot: a tool that finds bootable kernel configurations on the local disks and boots them.

  • systemboot: a wrapper around fbnetboot and localboot that just mimicks a BIOS/UEFI BDS behaviour, by looping between network booting and local booting. Use -uinitcmd argument to the u-root build tool to make it the boot program.

This project started as a loose collection of programs in u-root by various LinuxBoot contributors, as well as a personal experiment by Andrea Barberio that has since been merged in. It is now an effort of a broader community and graduated to a real project for system firmwares.

More detailed information about the build process for a full LinuxBoot firmware image using u-root/systemboot and coreboot can be found in the LinuxBoot book chapter about LinuxBoot using coreboot, u-root and systemboot.

You can build systemboot like this:

u-root -uinitcmd=systemboot core ./cmds/boot/{systemboot,localboot,fbnetboot}

Compression

You can compress the initramfs. However, for xz compression, the kernel has some restrictions on the compression options and it is suggested to align the file to 512 byte boundaries:

xz --check=crc32 -9 --lzma2=dict=1MiB \
   --stdout /tmp/initramfs.linux_amd64.cpio \
   | dd conv=sync bs=512 \
   of=/tmp/initramfs.linux_amd64.cpio.xz

Getting Packages of TinyCore

Using the tcz command included in u-root, you can install tinycore linux packages for things you want.

You can use QEMU NAT to allow you to fetch packages. Let's suppose, for example, you want bash. Once u-root is running, you can do this:

% tcz bash

The tcz command computes and fetches all dependencies. If you can't get to tinycorelinux.net, or you want package fetching to be faster, you can run your own server for tinycore packages.

You can do this to get a local server using the u-root srvfiles command:

% srvfiles -p 80 -d path-to-local-tinycore-packages

Of course you have to fetch all those packages first somehow :-)

Build an Embeddable U-root

You can build this environment into a kernel as an initramfs, and further embed that into firmware as a coreboot payload.

In the kernel and coreboot case, you need to configure ethernet. We have a dhclient command that works for both ipv4 and ipv6. Since v6 does not yet work that well for most people, a typical invocation looks like this:

% dhclient -ipv4 -ipv6=false

Or, on newer linux kernels (> 4.x) boot with ip=dhcp in the command line, assuming your kernel is configured to work that way.

Build Modes

u-root can create an initramfs in two different modes, specified by -build:

  • bb/gbb mode: One busybox-like binary comprising all the Go tools you ask to include. See here for how it works.

    In this mode, u-root copies and rewrites the source of the tools you asked to include to be able to compile everything into one busybox-like binary.

  • binary mode: each specified binary is compiled separately and all binaries are added to the initramfs.

Updating Dependencies

go get -u
go mod tidy
go mod vendor

Hardware

If you want to see u-root on real hardware, this board is a good start.

Contributions

For information about contributing, including how we sign off commits, please see CONTRIBUTING.md.

Improving existing commands (e.g., additional currently unsupported flags) is very welcome. In this case it is not even required to build an initramfs, just enter the cmds/ directory and start coding. A list of commands that are on the roadmap can be found here.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmds
boot/pxeboot
Command pxeboot implements PXE-based booting.
Command pxeboot implements PXE-based booting.
contrib/flash
flash reads and writes to a flash chip.
flash reads and writes to a flash chip.
contrib/spidev
spidev communicates with the Linux spidev driver.
spidev communicates with the Linux spidev driver.
core/basename
Basename return name with leading path information removed.
Basename return name with leading path information removed.
core/blkid
Blkid prints information about blocks.
Blkid prints information about blocks.
core/cat
cat concatenates files and prints them to stdout.
cat concatenates files and prints them to stdout.
core/chmod
chmod changes mode bits (e.g.
chmod changes mode bits (e.g.
core/cmp
cmp compares two files and prints a message if their contents differ.
cmp compares two files and prints a message if their contents differ.
core/comm
comm compares two files.
comm compares two files.
core/cp
cp copies files.
cp copies files.
core/cpio
cpio operates on cpio files using a cpio package It only implements basic cpio options.
cpio operates on cpio files using a cpio package It only implements basic cpio options.
core/date
date prints the date.
date prints the date.
core/dd
dd converts and copies a file.
dd converts and copies a file.
core/df
df reports details of mounted filesystems.
df reports details of mounted filesystems.
core/dhclient
dhclient sets up network config using DHCP.
dhclient sets up network config using DHCP.
core/dirname
dirname prints out the directory name of one or more args.
dirname prints out the directory name of one or more args.
core/dmesg
dmesg reads the system log.
dmesg reads the system log.
core/echo
echo writes its arguments separated by blanks and terminated by a newline on the standard output.
echo writes its arguments separated by blanks and terminated by a newline on the standard output.
core/false
false returns 1.
false returns 1.
core/find
Find finds files.
Find finds files.
core/free
free reports usage information for physical memory and swap space.
free reports usage information for physical memory and swap space.
core/fusermount
fusermount is a very limited replacement for the C fusermount.
fusermount is a very limited replacement for the C fusermount.
core/gpgv
gpgv validates a signature against a file.
gpgv validates a signature against a file.
core/gpt
gpt reads and writes GPT headers.
gpt reads and writes GPT headers.
core/grep
grep searches file contents using regular expressions.
grep searches file contents using regular expressions.
core/gzip
gzip compresses files using gzip compression.
gzip compresses files using gzip compression.
core/hexdump
hexdump prints file content in hexadecimal.
hexdump prints file content in hexadecimal.
core/hostname
hostname prints or changes the system's hostname.
hostname prints or changes the system's hostname.
core/hwclock
hwclock reads or changes the hardware clock (RTC) in UTC format.
hwclock reads or changes the hardware clock (RTC) in UTC format.
core/id
id displays the user id, group id, and groups of the calling process.
id displays the user id, group id, and groups of the calling process.
core/init
init is u-root's standard userspace init process.
init is u-root's standard userspace init process.
core/insmod
insmod inserts a module into the running Linux kernel.
insmod inserts a module into the running Linux kernel.
core/io
io reads and writes to physical memory and ports.
io reads and writes to physical memory and ports.
core/ip
ip manipulates network addresses, interfaces, routing, and other config.
ip manipulates network addresses, interfaces, routing, and other config.
core/kill
Kill kills processes.
Kill kills processes.
core/lddfiles
lddfiles prints the arguments and all .so dependencies of those arguments
lddfiles prints the arguments and all .so dependencies of those arguments
core/ln
Ln makes links to files.
Ln makes links to files.
core/lockmsrs
lockmsrs locks important intel MSRs.
lockmsrs locks important intel MSRs.
core/losetup
losetup sets up and controls loop devices.
losetup sets up and controls loop devices.
core/ls
ls prints the contents of a directory.
ls prints the contents of a directory.
core/lsdrivers
lsdrivers lists driver usage on Linux systems
lsdrivers lists driver usage on Linux systems
core/lsmod
lsmod list currently loaded Linux kernel modules.
lsmod list currently loaded Linux kernel modules.
core/man
man - print manual entry for command.
man - print manual entry for command.
core/man/data
Code generated by man/gen/gen.go.
Code generated by man/gen/gen.go.
core/md5sum
md5sum prints an md5 hash generated from file contents.
md5sum prints an md5 hash generated from file contents.
core/mkdir
mkdir makes a new directory.
mkdir makes a new directory.
core/mkfifo
mkfifo creates a named pipe.
mkfifo creates a named pipe.
core/mknod
Unmount a filesystem at the specified path.
Unmount a filesystem at the specified path.
core/mktemp
Mktemp makes a temporary file (or directory)
Mktemp makes a temporary file (or directory)
core/more
More pages through files without any terminal trickery.
More pages through files without any terminal trickery.
core/mount
mount mounts a filesystem at the specified path.
mount mounts a filesystem at the specified path.
core/msr
msr -- read and write MSRs with regular command or Forth
msr -- read and write MSRs with regular command or Forth
core/mv
mv renames files and directories.
mv renames files and directories.
core/netcat
netcat creates arbitrary TCP and UDP connections and listens and sends arbitrary data.
netcat creates arbitrary TCP and UDP connections and listens and sends arbitrary data.
core/ntpdate
ntpdate uses NTP to adjust the system clock.
ntpdate uses NTP to adjust the system clock.
core/pci
pci: show pci bus vendor ids and other info
pci: show pci bus vendor ids and other info
core/ping
Send icmp packets to a server to test network connectivity.
Send icmp packets to a server to test network connectivity.
core/poweroff
poweroff turns the system off, without delay.
poweroff turns the system off, without delay.
core/printenv
Print environment variables.
Print environment variables.
core/ps
Print process information.
Print process information.
core/pwd
Print name of current directory.
Print name of current directory.
core/readlink
readlink display value of symbolic link file.
readlink display value of symbolic link file.
core/rm
Delete files.
Delete files.
core/rmmod
Remove a module from the Linux kernel
Remove a module from the Linux kernel
core/rsdp
rsdp allows to determine the ACPI RSDP structure address which could be passed to the boot command later on It must be executed at the system init as it relies on scanning the kernel messages which could be quickly filled up in some cases
rsdp allows to determine the ACPI RSDP structure address which could be passed to the boot command later on It must be executed at the system init as it relies on scanning the kernel messages which could be quickly filled up in some cases
core/scp
Scp copies files between hosts on a network.
Scp copies files between hosts on a network.
core/seq
Print a sequence of numbers.
Print a sequence of numbers.
core/shutdown
shutdown halts, suspends, or reboots at a specified time, or immediately.
shutdown halts, suspends, or reboots at a specified time, or immediately.
core/sleep
Delay for the specified amount of time.
Delay for the specified amount of time.
core/sort
Sort lines.
Sort lines.
core/strace
strace is a simple multi-process syscall & signal tracer.
strace is a simple multi-process syscall & signal tracer.
core/strings
Strings finds printable strings.
Strings finds printable strings.
core/stty
The command works like this: stty [verb] [options] Verbs are: dump -- dump the json of the struct to stdout load -- read a json file from stdin and use it to set raw -- convenience command to set raw cooked -- convenience command to set cooked In common stty usage, options may be specified without a verb.
The command works like this: stty [verb] [options] Verbs are: dump -- dump the json of the struct to stdout load -- read a json file from stdin and use it to set raw -- convenience command to set raw cooked -- convenience command to set cooked In common stty usage, options may be specified without a verb.
core/tar
Create and extract tar archives.
Create and extract tar archives.
core/tee
Tee transcribes the standard input to the standard output and makes copies in the files.
Tee transcribes the standard input to the standard output and makes copies in the files.
core/time
Time process execution.
Time process execution.
core/true
Returns 0.
Returns 0.
core/truncate
Truncate - shrink or extend the size of a file to the specified size
Truncate - shrink or extend the size of a file to the specified size
core/ts
ts prepends each line of stdin with a timestamp.
ts prepends each line of stdin with a timestamp.
core/umount
Unmount a filesystem at the specified path.
Unmount a filesystem at the specified path.
core/uname
Print build information about the kernel and machine.
Print build information about the kernel and machine.
core/uniq
Uniq removes repeated lines.
Uniq removes repeated lines.
core/unmount
Unmount unmounts new from old, or everything mounted on old if new is omitted.
Unmount unmounts new from old, or everything mounted on old if new is omitted.
core/unshare
Disassociate parts of the process execution context.
Disassociate parts of the process execution context.
core/uptime
Get the time the machine has been up Synopsis:
Get the time the machine has been up Synopsis:
core/watchdog
watchdog interacts with /dev/watchdog.
watchdog interacts with /dev/watchdog.
core/watchdogd
watchdogd is a background daemon for petting the watchdog.
watchdogd is a background daemon for petting the watchdog.
core/wc
Wc counts lines, words, runes, syntactically–invalid UTF codes.
Wc counts lines, words, runes, syntactically–invalid UTF codes.
core/wget
Wget reads one file from a url and writes to stdout.
Wget reads one file from a url and writes to stdout.
core/which
Which locates a command.
Which locates a command.
exp/acpicat
acpicat cats ACPI tables from the kernel.
acpicat cats ACPI tables from the kernel.
exp/acpigrep
grep a stream of ACPI tables by regexp
grep a stream of ACPI tables by regexp
exp/ansi
Print ansi escape sequences.
Print ansi escape sequences.
exp/bootvars
Command bootvars reads the current UEFI boot variables.
Command bootvars reads the current UEFI boot variables.
exp/bzimage
bzImage is used to modify bzImage files.
bzImage is used to modify bzImage files.
exp/cbmem
cbmem prints out coreboot mem table information in JSON by default, and also implements the basic cbmem -list and -console commands.
cbmem prints out coreboot mem table information in JSON by default, and also implements the basic cbmem -list and -console commands.
exp/console
console implements a basic console.
console implements a basic console.
exp/crc
Prints crc checksum of a file.
Prints crc checksum of a file.
exp/disk_unlock
The disk_unlock command is used to unlock a disk drive as follows: 1.
The disk_unlock command is used to unlock a disk drive as follows: 1.
exp/dumpebda
dumpebda reads and prints the Extended BIOS Data Area.
dumpebda reads and prints the Extended BIOS Data Area.
exp/ectool
These should all implement io.ReadAt, with the address as the Offset; same for WriteAt.
These should all implement io.ReadAt, with the address as the Offset; same for WriteAt.
exp/ed
address.go - contains methods for FileBuffer for line address resolution
address.go - contains methods for FileBuffer for line address resolution
exp/fdtdump
fdtdump prints a readable version of Flattened Device Tree or dtb.
fdtdump prints a readable version of Flattened Device Tree or dtb.
exp/field
The `field` command reads newline-separated lines of data from either the standard input or the specified files.
The `field` command reads newline-separated lines of data from either the standard input or the specified files.
exp/fixrsdp
fixrsdp copies the existing RSDP into the EBDA region in low mem.
fixrsdp copies the existing RSDP into the EBDA region in low mem.
exp/forth
Forth is a forth interpreter.
Forth is a forth interpreter.
exp/freq
Freq reads the given files (default standard input) and prints histograms of the character frequencies.
Freq reads the given files (default standard input) and prints histograms of the character frequencies.
exp/getty
getty Open a TTY and invoke a shell There are no special options and no login support Also getty exits after starting the shell so if one exits the shell, there is no more shell!
getty Open a TTY and invoke a shell There are no special options and no login support Also getty exits after starting the shell so if one exits the shell, there is no more shell!
exp/hdparm
hdparm performs control operations on disks.
hdparm performs control operations on disks.
exp/ipmidump
Synopsis:
Synopsis:
exp/madeye
madeye merges multiple architecture u-root initramfs to form a single universal initramfs.
madeye merges multiple architecture u-root initramfs to form a single universal initramfs.
exp/modprobe
modprobe - Add and remove modules from the Linux Kernel
modprobe - Add and remove modules from the Linux Kernel
exp/page
Synopsis:
Synopsis:
exp/partprobe
partprobe prompts the OS to re-read partition tables.
partprobe prompts the OS to re-read partition tables.
exp/pox
pox packages dynamic executable into an archive.
pox packages dynamic executable into an archive.
exp/pxeserver
pxeserver is a test & lab PXE server that supports TFTP, HTTP, and DHCPv4.
pxeserver is a test & lab PXE server that supports TFTP, HTTP, and DHCPv4.
exp/readpe
Dump the headers of a PE file.
Dump the headers of a PE file.
exp/run
Run executes its arguments as a Go program.
Run executes its arguments as a Go program.
exp/rush
our first builtin: cd
our first builtin: cd
exp/smbios_transfer
smbios_transfer sends SMBIOS tables to BMC through IPMI blob interfaces.
smbios_transfer sends SMBIOS tables to BMC through IPMI blob interfaces.
exp/smn
smn: read or write registers in the System Management Network on AMD cpus
smn: read or write registers in the System Management Network on AMD cpus
exp/srvfiles
Serve files on the network.
Serve files on the network.
exp/ssh
SSH client.
SSH client.
exp/syscallfilter
syscallfilter runs a command with a possibly empty set of filters:
syscallfilter runs a command with a possibly empty set of filters:
exp/tac
tac concatenates files and prints to stdout in reverse order, file by file
tac concatenates files and prints to stdout in reverse order, file by file
exp/watch
watch periodically executes the executable specified in argument.
watch periodically executes the executable specified in argument.
exp/zbi
zbi dumps the header of a Zircon boot image.
zbi dumps the header of a Zircon boot image.
exp/zimage
zimage dumps the header of a zImage.
zimage dumps the header of a zImage.
examples
uinit
This is a basic init script.
This is a basic init script.
integration
pkg
acpi
Package acpi reads, modifies, and writes ACPI tables.
Package acpi reads, modifies, and writes ACPI tables.
align
Package align provides helpers for doing uint alignment.
Package align provides helpers for doing uint alignment.
bb
Package bb builds one busybox-like binary out of many Go command sources.
Package bb builds one busybox-like binary out of many Go command sources.
bb/bbmain
Package bbmain is the package imported by all rewritten busybox command-packages to register themselves.
Package bbmain is the package imported by all rewritten busybox command-packages to register themselves.
bb/bbmain/cmd
Package main is the busybox main.go template.
Package main is the busybox main.go template.
boot
Package boot is the high-level interface for booting another operating system from Linux using kexec.
Package boot is the high-level interface for booting another operating system from Linux using kexec.
boot/bls
Package bls parses systemd Boot Loader Spec config files.
Package bls parses systemd Boot Loader Spec config files.
boot/bootcmd
Package bootcmd handles common cleanup functions and flags that all boot commands should support.
Package bootcmd handles common cleanup functions and flags that all boot commands should support.
boot/boottest
Package boottest contains methods for comparing boot.OSImages to each other and to JSON representations of themselves for use in tests.
Package boottest contains methods for comparing boot.OSImages to each other and to JSON representations of themselves for use in tests.
boot/bzimage
Package bzimage implements decoding for bzImage files.
Package bzimage implements decoding for bzImage files.
boot/ebda
Package ebda looks for the Extended Bios Data Area (EBDA) pointer in /dev/mem, and provides access to the EBDA.
Package ebda looks for the Extended Bios Data Area (EBDA) pointer in /dev/mem, and provides access to the EBDA.
boot/esxi
Package esxi contains an ESXi boot config parser for disks and CDROMs.
Package esxi contains an ESXi boot config parser for disks and CDROMs.
boot/fit
Package fit provides tools to read and verify FIT kernel images See https://doc.coreboot.org/lib/payloads/fit.html
Package fit provides tools to read and verify FIT kernel images See https://doc.coreboot.org/lib/payloads/fit.html
boot/grub
Package grub implements a grub config file parser.
Package grub implements a grub config file parser.
boot/ibft
Package ibft defines the iSCSI Boot Firmware Table.
Package ibft defines the iSCSI Boot Firmware Table.
boot/image
Package image contains a parser for Arm64 Linux Image format.
Package image contains a parser for Arm64 Linux Image format.
boot/kexec
Package kexec implements kexec load and file load syscall API.
Package kexec implements kexec load and file load syscall API.
boot/linux
The linux package loads bzImage-based Linux kernels using the kexec_load system call.
The linux package loads bzImage-based Linux kernels using the kexec_load system call.
boot/localboot
Package localboot contains helper functions for booting off local disks.
Package localboot contains helper functions for booting off local disks.
boot/menu
Package menu displays a Terminal UI based text menu to choose boot options from.
Package menu displays a Terminal UI based text menu to choose boot options from.
boot/multiboot
Package multiboot implements bootloading multiboot kernels as defined by https://www.gnu.org/software/grub/manual/multiboot/multiboot.html.
Package multiboot implements bootloading multiboot kernels as defined by https://www.gnu.org/software/grub/manual/multiboot/multiboot.html.
boot/multiboot/internal/trampoline
Package trampoline sets machine to a specific state defined by multiboot v1 spec and jumps to the intended kernel.
Package trampoline sets machine to a specific state defined by multiboot v1 spec and jumps to the intended kernel.
boot/netboot
Package netboot provides a one-stop shop for netboot parsing needs.
Package netboot provides a one-stop shop for netboot parsing needs.
boot/netboot/ipxe
Package ipxe implements a trivial IPXE config file parser.
Package ipxe implements a trivial IPXE config file parser.
boot/netboot/pxe
Package pxe implements the PXE config file parsing.
Package pxe implements the PXE config file parsing.
boot/purgatory
Package purgatory provides several purgatories for use with kexec_load system call.
Package purgatory provides several purgatories for use with kexec_load system call.
boot/syslinux
Package syslinux implements a syslinux config file parser.
Package syslinux implements a syslinux config file parser.
boot/zbi
Package zbi contains a parser for the Zircon boot image format.
Package zbi contains a parser for the Zircon boot image format.
boot/zimage
Package zimage contains a Parser for the arm zImage Linux format.
Package zimage contains a Parser for the arm zImage Linux format.
cmdline
Package cmdline is parser for kernel command-line args from /proc/cmdline.
Package cmdline is parser for kernel command-line args from /proc/cmdline.
cmos
Package cmos lets you read and write to cmos registers while doing basic checks on valid register selections.
Package cmos lets you read and write to cmos registers while doing basic checks on valid register selections.
cp
Package cp implements routines to copy files.
Package cp implements routines to copy files.
cpio
Package cpio implements utilities for reading and writing cpio archives.
Package cpio implements utilities for reading and writing cpio archives.
curl
Package curl implements routines to fetch files given a URL.
Package curl implements routines to fetch files given a URL.
dhclient
Package dhclient allows for getting both DHCPv4 and DHCPv6 leases on multiple network interfaces in parallel.
Package dhclient allows for getting both DHCPv4 and DHCPv6 leases on multiple network interfaces in parallel.
dt
Package dt contains utilities for device tree.
Package dt contains utilities for device tree.
efivarfs
Package efivarfs allows interaction with efivarfs of the linux kernel.
Package efivarfs allows interaction with efivarfs of the linux kernel.
fb
fdsrv
Serves a file descriptor over an AF_UNIX socket when presented with a nonce.
Serves a file descriptor over an AF_UNIX socket when presented with a nonce.
find
Package find searches for files in a directory hierarchy recursively.
Package find searches for files in a directory hierarchy recursively.
flash
Package flash provides higher-level functions such as reading, erasing, writing and programming the flash chip.
Package flash provides higher-level functions such as reading, erasing, writing and programming the flash chip.
flash/op
Package op contains available SPI opcodes.
Package op contains available SPI opcodes.
flash/sfdp
Package sfdp reads the SFDP (Serial Flash Discoverable Parameters) from a flash chip where supported.
Package sfdp reads the SFDP (Serial Flash Discoverable Parameters) from a flash chip where supported.
flash/spimock
Package spimock provides a fake SPI flash part for unit testing.
Package spimock provides a fake SPI flash part for unit testing.
forth
Package forth implements Forth parsing, which allows programs to use forth-like syntax to manipulate a stack of Cells.
Package forth implements Forth parsing, which allows programs to use forth-like syntax to manipulate a stack of Cells.
golang
Package golang is an API to the Go compiler.
Package golang is an API to the Go compiler.
gpio
Package gpio provides functions for interacting with GPIO pins via the GPIO Sysfs Interface for Userspace.
Package gpio provides functions for interacting with GPIO pins via the GPIO Sysfs Interface for Userspace.
ipmi
Package ipmi implements functions to communicate with the OpenIPMI driver interface.
Package ipmi implements functions to communicate with the OpenIPMI driver interface.
ipmi/blobs
Package blobs implements OpenBMC IPMI Blob Protocol commands.
Package blobs implements OpenBMC IPMI Blob Protocol commands.
ipmi/ocp
Package ocp implements OCP/Facebook-specific IPMI client functions.
Package ocp implements OCP/Facebook-specific IPMI client functions.
kmodule
Package kmodule interfaces with Linux kernel modules.
Package kmodule interfaces with Linux kernel modules.
ldd
ldd returns all the library dependencies of an executable.
ldd returns all the library dependencies of an executable.
libinit
Package libinit creates the environment and root file system for u-root.
Package libinit creates the environment and root file system for u-root.
lockfile
Package lockfile coordinates process-based file locking.
Package lockfile coordinates process-based file locking.
ls
Package ls implements formatting tools to list files like the Linux ls tool.
Package ls implements formatting tools to list files like the Linux ls tool.
mei
Package mei implements a wrapper on top of Linux's MEI (Intel ME Interface, formerly known as HECI).
Package mei implements a wrapper on top of Linux's MEI (Intel ME Interface, formerly known as HECI).
mount
Package mount implements mounting, moving, and unmounting file systems.
Package mount implements mounting, moving, and unmounting file systems.
mount/block
Package block finds, mounts, and modifies block devices on Linux systems.
Package block finds, mounts, and modifies block devices on Linux systems.
mount/gpt
Package gpt implements reading and writing of GUID Partition tables.
Package gpt implements reading and writing of GUID Partition tables.
mount/loop
Package loop provides an interface to interacting with Linux loop devices.
Package loop provides an interface to interacting with Linux loop devices.
mount/mtd
Chips are made by vendors, and an individual vendor is defined by a 1 to 8 byte vendor id stored in the chip.
Chips are made by vendors, and an individual vendor is defined by a 1 to 8 byte vendor id stored in the chip.
mount/scuzz
Package scuzz supports direct access to SCSI or SATA devices.
Package scuzz supports direct access to SCSI or SATA devices.
msr
This file contains support functions for msr access for Linux.
This file contains support functions for msr access for Linux.
namespace
Package namespace parses name space description files https://plan9.io/magic/man2html/6/namespace
Package namespace parses name space description files https://plan9.io/magic/man2html/6/namespace
pci
pty
Package pty provides basic pty support.
Package pty provides basic pty support.
qemu
Package qemu provides a Go API for starting QEMU VMs.
Package qemu provides a Go API for starting QEMU VMs.
rand
Package rand implements cancelable reads from a cryptographically safe random number source.
Package rand implements cancelable reads from a cryptographically safe random number source.
rtc
securelaunch
Package securelaunch takes integrity measurements before launching the target system.
Package securelaunch takes integrity measurements before launching the target system.
securelaunch/eventlog
Package eventlog parses kernel event logs and saves the parsed data on a file on disk.
Package eventlog parses kernel event logs and saves the parsed data on a file on disk.
securelaunch/launcher
Package launcher boots the target kernel.
Package launcher boots the target kernel.
securelaunch/measurement
Package measurement provides different collectors to hash files, disks, dmi info and cpuid info.
Package measurement provides different collectors to hash files, disks, dmi info and cpuid info.
securelaunch/policy
Package policy locates and parses a JSON policy file.
Package policy locates and parses a JSON policy file.
securelaunch/tpm
Package tpm reads and extends pcrs with measurements.
Package tpm reads and extends pcrs with measurements.
sh
shlex
Package shlex is a simplified command-line shell-like argument parser.
Package shlex is a simplified command-line shell-like argument parser.
smbios
Package smbios parses SMBIOS tables into Go structures.
Package smbios parses SMBIOS tables into Go structures.
spidev
Package spidev wraps the Linux spidev driver and performs low-level SPI operations.
Package spidev wraps the Linux spidev driver and performs low-level SPI operations.
strace
Package strace traces Linux process events.
Package strace traces Linux process events.
strace/internal/abi
Package abi describes the interface between a kernel and userspace.
Package abi describes the interface between a kernel and userspace.
strace/internal/binary
Package binary translates between select fixed-sized types and a binary representation.
Package binary translates between select fixed-sized types and a binary representation.
syscallfilter
Package syscallfilter supports filtering child process events by system call or strace event.
Package syscallfilter supports filtering child process events by system call or strace event.
termios
Package termios implements basic termios operations including getting a tty struct, termio struct, a winsize struct, and setting raw mode.
Package termios implements basic termios operations including getting a tty struct, termio struct, a winsize struct, and setting raw mode.
ts
Package ts contains a Transform to prepend a timestamp in front of each line.
Package ts contains a Transform to prepend a timestamp in front of each line.
tss
Package tss provides TPM 1.2/2.0 core functionality and abstraction layer for high-level functions
Package tss provides TPM 1.2/2.0 core functionality and abstraction layer for high-level functions
ubinary
Package ubinary provides a native endian binary.ByteOrder.
Package ubinary provides a native endian binary.ByteOrder.
uefivars
Package uefivars manipulates UEFI variables, and can encode and decode the mixed-endianness GUIDs used by UEFI (and MS).
Package uefivars manipulates UEFI variables, and can encode and decode the mixed-endianness GUIDs used by UEFI (and MS).
uefivars/boot
Package boot manipulates UEFI boot variables, and can identify and mount the volume referenced by a boot var.
Package boot manipulates UEFI boot variables, and can identify and mount the volume referenced by a boot var.
uefivars/vartest
Package vartest contains utility functions for testing uefivars and subpackages.
Package vartest contains utility functions for testing uefivars and subpackages.
uflag
Package uflag supports u-root-custom flags as well as flag files.
Package uflag supports u-root-custom flags as well as flag files.
uio
Package uio unifies commonly used io utilities for u-root.
Package uio unifies commonly used io utilities for u-root.
ulog
Package ulog exposes logging via a Go interface.
Package ulog exposes logging via a Go interface.
ulog/ulogtest
Package ulogtest implement the Logger interface via a test's testing.TB.Logf.
Package ulogtest implement the Logger interface via a test's testing.TB.Logf.
upath
Package upath contains utilities for dealing with symlinked paths.
Package upath contains utilities for dealing with symlinked paths.
uroot
Package uroot creates root file systems from Go programs.
Package uroot creates root file systems from Go programs.
uzip
Package uzip contains utilities for file system->zip and zip->file system conversions.
Package uzip contains utilities for file system->zip and zip->file system conversions.
vfile
Package vfile verifies files against a hash or signature.
Package vfile verifies files against a hash or signature.
vpd
watchdog
Package watchdog provides functions for interacting with the Linux watchdog.
Package watchdog provides functions for interacting with the Linux watchdog.
tools
build_perf
Measure the performance of building all the Go commands under various GOGC values.
Measure the performance of building all the Go commands under various GOGC values.
checklicenses
Run with `go run checklicenses.go`.
Run with `go run checklicenses.go`.
makebb
makebb compiles many Go commands into one bb-style binary.
makebb compiles many Go commands into one bb-style binary.
makebbmain
makebbmain creates a bb main.go source file.
makebbmain creates a bb main.go source file.
mkinitramfs
mkinitramfs creates a u-root initramfs given the list of files on the command line.
mkinitramfs creates a u-root initramfs given the list of files on the command line.
testramfs
testramfs tests things, badly
testramfs tests things, badly

Jump to

Keyboard shortcuts

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