Reference

loader.kboot(8)

LinuxBoot kernel loader

NAME

loader.kboot – LinuxBoot kernel loader

DESCRIPTION

loader.kboot loads FreeBSD under “LinuxBoot”: a Linux kernel is used as the platform firmware, and loader.kboot runs as an ordinary Linux userland program on top of it to load the FreeBSD kernel. It is linked statically to minimize dependencies.

loader.kboot can run at any time during the boot process as a normal program. When running as init (PID 1), loader.kboot mounts /proc, /sys, /dev and /tmp; creates the usual compatibility symlinks (/dev/fd, /dev/stdin, /dev/stdout, /dev/stderr); and switches its own stdio to /dev/console before doing anything else. loader.kboot implements all the usual FreeBSD 8(loader) and 8(loader_lua) features.

Devices

Disks are accessed through their Linux /dev names, not the FreeBSD names:

/dev/sda:

/dev/nvme0n1p3:

The environment variable hostdisk_override may be set, before disk probing runs, to the path of a regular file. When unset, /sys/block is scanned for all available devices.

The host filesystem gives access to files on the Linux host's own root filesystem, rooted at the value of the hostfs_root environment variable (default “/”). Paths beginning with /sys/ or /proc/ bypass this rooting and are passed to the host unchanged, since those are kernel-provided filesystems rather than part of any disk image. A path starting with two slashes has one slash stripped and is otherwise unchanged.

bootdev selects the boot device, using the same naming as currdev. If unset, disks and their partitions found under /sys/block are tried in turn, followed by any ZFS pools found on them; failing all of that, “host:/” is used.

Firmware tables

Since there is no direct firmware access, ACPI's RSDP and the SMBIOS entry point are recovered from the Linux EFI system table exposed at /sys/firmware/efi/systab, if present. SMBIOS data itself is read from /sys/firmware/dmi/tables/DMI. When those are unavailable, loader.kboot attempts to use /dev/mem, though that often is also unavailable.

Kernel hand-off

loader.kboot uses the kexec_load feature to stage the kernel, kernel modules, tuneables and other metadata in an intermediate buffer. loader.kboot then calls reboot() with special arguments and he Linux kernel will then move these to the requested location (if necessary) and jumps to the new kernel.

FILES

/boot/loader.kboot

loader.kboot itself.

/boot/lua/loader.lua

The script run by loader.kboot on startup; see loader_lua(8).

SEE ALSO

loader(8) loader_lua(8)

HISTORY

loader.kboot first appeared in FreeBSD 11.0 as part of the PS3 port, and later generalized to several members of the PowerPC family. Support for aarch64 and amd64 was added in FreeBSD 14.0.

AUTHORS

loader.kboot was written by Nathan Whitehorn ⟨[email protected]⟩. Support was generalized by Warner Losh ⟨[email protected]⟩.