Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

80.17. efibootmgr-18

Lists, adds and reorders EFI boot entries

Version 18, release 1
Shelf boot — Everything before userspace: the kernel, microcode, firmware for the host, bootloader and EFI tooling
Phase 41_system (System), 235 of 1047 in build order
Licence GPL-2.0-or-later
Homepage https://github.com/rhboot/efibootmgr
Build time 0.1 SBU
Installed size 123.9 KiB in 6 files
Recipe ports/core/boot/efibootmgr/kpkgbuild

About

efibootmgr reads and changes the UEFI firmware’s boot entries, the Boot#### variables and BootOrder kept in NVRAM, through the kernel’s efivarfs. kinstall runs it once, as efibootmgr --create --disk … --part … --loader … --label KDOS, to write the KDOS entry for the loader the firmware can run; see The NVRAM boot entry. It is installed on every system, not only on the installer’s medium: a firmware that later reorders or drops the entry leaves a KDOS install that does not boot, and without a tool on the running system the only repair is the firmware’s own menu. It reads and writes the variables with the libefivar and libefiboot libraries of efivar.

Why it is in KDOS

The comment above efivar and efibootmgr in script/phases/41_system/packages.d/boot.txt:

kinstall writes an EFI entry once. Every later firmware that reorders or drops it needs a tool on the RUNNING system, or a KDOS install that stops booting has no repair path outside a firmware menu.

Sources

Dependencies

Depends on: pkgconf, efivar, popt.

Required by: no port names it.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install efibootmgr'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/boot/efibootmgr.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/boot/efibootmgr
echo '442867d12f8525034a404fc8af3036dba8e1fc970998af2486c3b940dfad0874  efibootmgr-18.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/efibootmgr
SRC=$SRC_ROOT/efibootmgr-18
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf efibootmgr-18.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

export CFLAGS="$CFLAGS -Wno-error -Wno-address -Wno-stringop-overflow"
make EFIDIR=kdos libdir=/usr/lib bindir=/usr/sbin mandir=/usr/share/man
make EFIDIR=kdos libdir=/usr/lib bindir=/usr/sbin mandir=/usr/share/man DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/efibootmgr, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf efibootmgr-18-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/efibootmgr, and runs the triggers its paths call for.

Contents

Installed programs: efibootdump, efibootmgr.

Installed directories: /usr/share/licenses/efibootmgr.

Short descriptions

efibootdump dump a boot entries from a variable or a file
efibootmgr change the UEFI Boot Manager configuration