EFI(8) System Manager's Manual EFI(8)

efiUEFI variable editor

efi [-CcDFfhNOqrTVvy] [--brief] [--debug[=num]] [-@ file] [-A [hexnum]] [-a [hexnum]] [-B [hexnum]] [-b hexnum] [-d disk] [-G [dev]] [-L label] [-l loader] [-n hexnum] [-o hexnum[,hexnum ...]] [-p num] [-R regexp] [-t seconds] [-w [sig]] [-X hexnum[,hexnum ...]] [-x hexnum[,hexnum ...]]

efi can display all UEFI variables visible at runtime. It can also create, modify, and delete boot related variables such as Boot####, BootOrder, BootNext, Driver####, DriverOrder, SysPrep####, and SysPrepOrder. It is designed to be API compatible with efibootmgr in Linux, so that grub can be installed from NetBSD. Future features may be coming.

Many efi options require a number (####) indicating which “Boot####” argument to modify. Many options take this as an argument, but it can also be set with the -b option. Note that the boot number is a hexadecimal in the range of 0 to 0xFFFF. It need not have a leading ‘0x’ prefix and it need not be zero padded to 4 hexdigits. By default, the boot number specifies the “Boot####” variable, but the -r and -y options can override this so that it applies to the “Driver####” and “SysPrep####” variables.

The following options are currently available:

Only show the variable name, UUID, attributes, and datasize that appear in the efi_var_ioc data structure (see <sys/efiio.h>). This is used when the structure of the data is not known by efi.
[=num]
Increment the debug level or set it to num when given. Its value is bit-mapped:

  • Bit(0): Show data structure.
  • Bit(1): Show raw data.
  • Bit(2): Show efi_var_ioc structure info (see --brief).
, --append-binary-args
Append content of file (use ‘-’ for stdin) to the variable data. This data is passed to the boot loader on its command line.
, --inactive [####]
Set given Boot#### variable inactive.
, --active [####]
Set given Boot#### variable active.
, --delete-bootnum [####]
Delete the Boot#### variable.
, --bootnum ####
Specify the boot number (i.e., the #### in Boot####) to use with other options.
, --create-only
Create a new Boot#### variable.
, --create
Same as -C, but add the bootnum to the bootorder.
, --remove-dups
Remove any duplicate BootOrder entries, retaining the first one in the list.
, --disk [dev]
Specify the device containing the boot loader. The default is the device containing the current directory.
, --no-reconnect
Do not force a devices reconnect after loading a driver.
, --reconnect
Force a reconnect of devices after loading a driver. This has no effect for non-Driver#### variables.
, --show-gpt [dev]
Show the GPT for the specified device. The default is the device containing the current directory. This currently assumes a widescreen for a readable display.
, --label LABEL
Label name displayed by the boot manager. Defaults to ‘NetBSD’.
, --loader NAME
Pathname of the boot loader relative to the specified partition. Defaults to \EFI\NetBSD\grub.efi. : EFI partitions are usually formatted as MSDOS partitions. Hence, the file separator is a backslash and may need to be escaped from the shell.
, --delete-bootnext
Delete the BootNext variable.
, --bootnext ####
Set the BootNext variable to Boot####.
, --delete-bootorder
Delete the BootOrder variable.
, --bootorder ####[,#### ...]
Set the BootOrder variable. The argument is a non-empty comma separated list of hex values. The hex values can range from 0 to FFFF and should correspond to one of the Boot#### variables.
, --part PART
Specify the partition index on the device that contains the bootloader binary. Normally, this is the 'EFI' partition. The default is partition index 1.
, --quiet
Run quietly — no output. (: not yet).
, --driver
Operate on Driver#### variables instead of Boot#### variables.
, --delete-timeout
Delete Timeout variable.
, --timeout secs
Set the boot manager Timeout variable, in seconds.
, --version
Print version string and exit. To keep grub-install happy, this is currently set to version 18.
, --verbose
Increment verboseness. This may be used multiple times. It is also passed directly to the GPT routines used by the -G and -w options.
, --write-signature [sig]
For MBR disks: If the MBR partition is missing a signature (i.e., is zero), set it to a random value. If the sig argument is specified, then set the MBR signature to that value overriding any previous setting. The signature is a four byte value and can be specified in hex, octal, or decimal. This takes precedence over all other options except -c.
, --remove-bootorder ####[,#### ...]
Remove argument(s) from the BootOrder variable.
, --prefix-bootorder ####[,#### ...]
Prefix argument(s) to the BootOrder variable.
, --sysprep
Operate on SysPrep#### variables instead of Boot#### variables.

efi requires kernel EFI runtime support and the device /dev/efi. Currently, efi only runs on little-endian machines, as required by the UEFI specification.

As of grub-install 2.12, the following efibootmgr options are used (see grub-2.12/grub-core/osdep/unix/platform.c):

Currently, the following efibootmgr options are not implemented in efi:

The following options in efi are not in efibootmgr:

In addition, several of the supported efibootmgr options now take optional arguments or comma delimited hex number arguments for convenience.

gpt(8)

efi attempts to follow version 2.10 Errata A (Aug 8, 2024) of the UEFI Specification (http://uefi.org).

efi was intended to be a NetBSD replacement for efibootmgr in Linux. The later is required by grub-install in the grub package. As a result, the interface is the same with a few exceptions. For efi to be used with grub-install it obviously needs to be renamed or linked to efibootmgr.

Probably way too many to list. Currently, efi has had very limited testing. Use it at your own risk!

February 23, 2025 NetBSD 10.99