Base packages and system updates

The build uses FreeBSD pkg 2.8.2 from contrib/pkg/ for binary packages and repository catalogs. The current little-endian RISC-V LP64 port has package ABI System:1:riscv64. The middle field tracks the native ABI independently of the System release version. Boot payloads also declare the platform they support.

Package definitions

Give each package one authoritative directory under packages/, such as packages/boot/, packages/libc/, packages/libsys/, packages/base-utils/, packages/kernel/, packages/servers/, or packages/brand-linux/. A package definition names its Xmake build targets, installed paths and file metadata, dependencies, and supported profiles. Package-owned defaults and installation tests can live beside the definition. Shared implementations and synchronized upstream sources are referenced from those definitions and follow the ownership rules in Architecture and source layout and Porting external software.

The kernel and native servers own their sources and Xmake targets under packages/kernel/ and packages/servers/. system-kernel ships the kernel ELF. system-servers ships the root supervisor and all native server and driver executables under /usr/libexec/system/ with root-only read permissions. Each server still has an independent build target, instance, and lifecycle. The native root image stages the server package and uses the same paths for optional activation.

The default native root configuration lives in packages/boot/native-root/etc/. The image builder installs group, master.passwd, and sysctl.conf in the guest’s /etc and derives the public passwd file from master.passwd.

The disk-image builder and binary package builder consume the same definitions. Xmake stages the outputs at their installation paths and supplies the metadata used by pkg create. The system-packages target also builds the System repository with pkg repo. Set SYSTEM_PKG_REPO_KEY to an RSA private key file for a signed catalog. Packages and catalogs use XZ-compressed tar archives. The host tool can install local archives and upgrade a staged root from a repository.

Guest archive reading uses libarchive 3.8.11 from contrib/libarchive/ and the XZ decoder from XZ Utils 5.8.4 in contrib/xz/. Xmake builds the tar reader and LZMA1/LZMA2 decoders as native static libraries. The decoder accepts CRC32 and CRC64 checks. A QEMU fixture reads an XZ-compressed manifest and payload through a native file descriptor.

Native package management follows the shared mapping and filesystem work in Stages 2.4 and 2.5. The guest pkg client uses the same System ABI and repository as the host tools. It needs native crypto and repository transport and uses directory-relative opens, metadata checks, and replacements to keep path resolution anchored to an open directory. The native port retains upstream SQLite write-ahead logging. The database needs shared mappings for the WAL index, interprocess locks, and durable ordering of writes. It can use fstatfs to check whether the filesystem behind its open directory is local. Pkg’s string builders use libc’s seekable open_memstream implementation.

Verify local pkg add and signed repository upgrades in a writable guest. Interrupt an upgrade on a disposable image, reboot, and check recovery of both the database and the installed files.

Packaging and activation are independent. An optional server can be installed without starting it. A build profile selects the required server set and includes its dependency closure in the boot bundle. The same package can contribute a server to one profile’s required set and supply it as an optional service on another. See Native server activation and supervision.

Boot generations

A boot generation ties together the kernel, root task, required server bundle, selected root filesystem server, and boot configuration. system-boot assembles matching outputs from the kernel and servers in the same build. Installing a kernel or server package stages files under /usr/libexec/system/. Publish the assembled system-boot package through the boot updater to change the active boot files. The updater checks the boot handoff and server ABI compatibility of the set and stages the new generation in a separate /boot/core/<profile> directory and makes it selectable after the complete payload and configuration are ready. Profiles with separate native roots identify their root partitions explicitly. If a generation requires a different native runtime ABI, it must select a compatible native root as part of the same update.

For a stopped RISC-V UEFI guest, the host updater checks the package ABI, platform, root filesystem, boot handoff and server ABI versions, and the SHA-256 of the complete payload set. It uses the existing root partition GUID. It writes payloads and Limine entries to a temporary disk image and publishes by atomic replacement of the regular disk image. Previous entries remain selectable. An interruption before replacement leaves the original disk available at the same path. This update path requires an offline image on a host filesystem with atomic rename. See Boot, platform handoff, and service recovery for boot profiles and root selection.