Zest (Zig-powered Embedded Systems Tool) is a modern, high-performance build system and distribution kit for embedded Linux. It aims to provide the flexibility of OpenWrt and the simplicity of Buildroot, while leveraging the safety and cross-compilation prowess of the Zig toolchain.
Traditional embedded build systems often suffer from "Makefile-hell" and global state issues. Zest replaces fragile shell scripting with a strictly typed, declarative build graph in Zig.
The goal is to move from "building a system" to "composing a system" from isolated, reproducible components.
To ensure absolute reproducibility and prevent "hidden dependency" bugs, Zest implements Isolated Sysroots.
- Isolation: Each package is built against a unique sysroot containing only its declared dependencies.
- Mechanism: Using Zig's
std.Buildgraph, Zest constructs a temporary directory tree for each build task. - Benefit: A package cannot accidentally link against a library that happened to be on the host or in a global buffer. If it's not in the
.zonmanifest, the compiler won't see it.
Zest treats Zig as a first-class compiler for C/C++ legacy code.
- The Wrapper: A custom Zig executable wraps
zig ccandzig c++, passing the correct--targetand--sysrootflags automatically. - Transparent Integration: This allows Zest to compile GNU Autotools, Meson, and Kconfig-based projects (like the Linux Kernel and Busybox) with zero changes to upstream source code.
Zest uses the APK (Alpine Package Keeper) format for its binary distribution.
- Efficiency: APKs are lightweight, fast to install, and support robust dependency resolution.
- Metadata: Every package generates a signed
.apkartifact, including metadata for architectures, versions, and provides/depends relationships.
The final stage of a Zest build is the Image Generation Step, which transforms built packages into a bootable system image.
- Composition: Instead of a simple
tarof a build directory, Zest uses a "Manifest + DeviceInfo" approach. - Process:
- Dependency Resolution: Collects all required
.apkfiles (base system + device-specific packages). - Rootfs Assembly: Uses
apk add --root(using a host-builtapk-tools) within afakerootenvironment. - Device Integration: Applies
deviceinfometadata to configure the kernel cmdline and bootloader (e.g., U-Boot, GRUB). - Finalization: Squashes the result into the target format (
squashfs,ext4, orinitramfs) and handles partitioning (GPT/MBR) for raw disk images.
- Dependency Resolution: Collects all required
To support a wide range of hardware without reinventing the wheel, Zest adopts the postmarketOS (pmOS) deviceinfo format.
- Declarative Devices: Device-specific metadata (kernel package, architecture, bootloader type) is stored in standardized
deviceinfofiles. - Image Generation: The image generation step uses this metadata to decide which kernel to include and how to partition the final image.
- Bootloader Integration: Zest automatically handles bootloader configuration (e.g.,
extlinux.conf,u-bootscripts) based on the target device's requirements.
- Fetch: Upstream sources are fetched and verified using Zig's content-addressable cache.
- Configure: The package is configured within its private sysroot.
- Compile: The Zig wrapper orchestrates the build, ensuring the correct cross-compilation flags are used.
- Package: Files are staged into an APK-compliant structure and compressed.
- Assemble: A high-level
imagetask selects the desired package set and produces the final firmware binary.
- Orchestrator: Zig 0.14.0+ Build System
- Compiler: Zig (
zig cc) - Standard Library: Musl libc
- Core Utilities: Busybox
- Package Manager: APK
- Host Requirements: Zig Compiler Only. (All necessary host tools like
fakeroot,apk-tools, and image generators are built from source as part of the Zest build graph).
- Developer Experience (DX): Write build logic in a modern, readable language (Zig) instead of obscure M4 macros or complex Makefiles.
- Performance: Parallelized builds by default, leveraging Zig's efficient build graph.
- Reliability: Per-package sysroots eliminate the "it works on my machine" syndrome in embedded Linux.