Systems
A project can contain build definitions for multiple types of systems. If you are developing an embedded device, it is very likely that you eventually need to support different versions or variants of the device simultaneously. Furthermore, you may want to build images and other artifacts specifically for testing purposes with development tooling and testing keys or certificates. You can do all that within a single Rugix Bakery project, allowing you to share build configurations between the different systems.
Systems are defined in the systems section of the project configuration.
Here is an example taken from the Debian template:
[systems.customized-arm64]
layer = "customized"
architecture = "arm64"
target = "generic-grub-efi"
Each system has a name (customized-arm64 in the example), is based on a layer providing the root filesystem and Linux kernel for that system (customized in the example), and has a concrete CPU architecture (arm64 in the example).
The target setting is optional and used to select defaults for supported devices (see below).
Build all published artifacts with:
./run-bakery bake system <system>
Select artifacts by published file name with repeatable --artifact flags.
For example, --artifact system.img skips bundle and SBOM work that the image
does not depend on. --output DIR replaces that directory with exactly the
selected artifacts and build-context.json. The default is build/<system>/.
bake image and bake bundle remain available as deprecated commands.
System Mixins
A mixin adds recipes and configuration after a system’s selected layer. This is useful for variations such as enabling debugging tools without creating a separate layer configuration. For example, define a mixin that enables SSH:
recipes = ["core/ssh"]Select it for a development system:
[systems.development]
layer = "customized"
architecture = "arm64"
target = "generic-grub-efi"
mixins = ["development"]Rugix Bakery builds the selected layer, applies the mixin, then assembles the resulting system. Mixins can declare dependencies on other mixins and use the same recipe parameters and artifact input bindings as layers. See the mixin schema for all settings.
Repository Build Rules
A system’s rules table declares named build rules.
Its outputs table maps published file names to artifacts from those rules.
Rugix Bakery builds the layer and prepares release metadata, then supplies its
root filesystem and other artifacts to those rules. The rules can
compose filesystem creation, boot packaging, signing, disk assembly, and update
bundle creation.
For example, this project builds a Debian root filesystem into an ext4 image and a tar archive. First, define a layer that sets the hostname:
parent = "core/debian-bookworm"
recipes = ["core/set-hostname"]
[parameters."core/set-hostname"]
hostname = "demo"Define a reusable pipeline with a rootfs input and two output artifacts:
[inputs.rootfs]
kind = "directory"
[parameters.label]
default = "system"
[execution]
type = "graph"
[execution.rules.filesystem]
uses = "core/image-ext4"
inputs.tree = { input = "rootfs" }
parameters.label = { parameter = "label" }
[execution.rules.archive]
uses = "core/archive-tree"
inputs.tree = { input = "rootfs" }
[execution.outputs]
image = { rule = { node = "filesystem", output = "image" } }
"rootfs.tar" = { rule = { node = "archive", output = "archive" } }Select that pipeline for a system:
[systems.demo]
layer = "demo"
architecture = "amd64"
[systems.demo.rules.release]
uses = "filesystem-release"
parameters.label = "demo-root"
[systems.demo.outputs]
"system.img" = { rule = { node = "release", output = "image" } }
"rootfs.tar" = { rule = { node = "release", output = "rootfs.tar" } }Here, uses names the rule directory. Rugix Bakery supplies the layer’s rootfs
artifact to the rule’s input of the same name. The composition connects it to
both core rules. The label parameter sets the ext4 volume label; the image
sizes itself from the filesystem tree.
Build the artifacts with:
./run-bakery bake system demo
The pipeline’s image output becomes build/demo/system.img, and its
rootfs.tar output becomes build/demo/rootfs.tar. This example produces a
filesystem image without a partition table, kernel, or bootloader. A bootable
pipeline must also prepare those artifacts. Systems can publish any artifacts;
system.img is required by run and test. These commands publish all system
artifacts except system.rugixb and system.rugixb-hash, preserving inventories
and other outputs alongside the image.
The rule can also live in a dependency repository. After adding that repository
to the project, select it with a qualified name such as
uses = "vendor/filesystem-release". The project still supplies the layer;
the repository supplies the reusable pipeline.
See Assemble a System for all supplied
artifacts and output conventions. Configure a repository pipeline through its
inputs and parameters. Every declared rule must be referenced transitively by an
output. Published names must be flat file names. build-context.json is reserved.
When target or image is set, the predefined pipeline runs as the reserved
node target. Systems that set only image use the unknown target. The
pipeline’s outputs are published by default. Rules can use its outputs, and
outputs can publish additional files. Their names must not collide with the
pipeline’s files. options and bundle require this pipeline.
Add an Inventory to a Verified System
The secure EFI template declares its verified boot pipeline as
systems.efi.rules.release. An independent rule can use the same prepared
root filesystem to create an SBOM. For example, add this rule:
[systems.efi.rules.sbom]
uses = "core/sbom"
inputs.tree = { input = "rootfs" }
Add this line to the existing [systems.efi.outputs] table:
"sbom.spdx.json" = { rule = { node = "sbom", output = "spdx" } }
The context input binds implicitly by name. Building efi publishes both
the verified artifacts and the inventory. Selecting only system.img skips
this independent SBOM rule and the update bundle.
Bundle Encoding
For generic-grub-efi, rpi-tryboot, rpi-uboot, and bsp, the predefined
pipeline publishes system.rugixb and system.rugixb-hash by default.
Systems without a target or with target = "unknown" default to no bundle;
explicitly enabling one is rejected.
Bundle payload compression defaults to true. The chunker uses the same syntax
as the bundle CLI, such as casync-64 or fixed-64, and defaults to casync-64.
For example:
[systems.device.bundle]
compression = false
chunker = "casync-64"
Set enabled = false to disable the bundle. BSP targets must declare
[[bundle.payloads]] in rugix-bsp.toml or disable bundles.
To speed up a development build, disable compression for a single build instead of changing the configuration:
./run-bakery bake system device --disable-compression
The flag overrides compression and applies only to systems with a target or
image. Other systems configure compression in their own bundle rules.
Targets
When declaring a system within the project configuration, you can specify a target that is appropriate for the respective device. The primary purpose of targets is to build system images that can be directly booted on supported devices. Targets typically support a whole family of devices and are categorized into generic, specific, and unknown targets.
- Generic targets are based on some standardized booting mechanism, such as UEFI or EBBR. Images built for generic targets are suitable for any device that supports the respective booting mechanism.
- Specific targets, on the other hand, are limited to a certain family of devices. Images built for specific targets come with all necessary device-specific configurations resulting in a bootable image that works out-of-the-box.
- Unknown targets are for devices that do not conform to a standardized booting mechanism and are not specifically supported by Rugix Bakery. Using unknown targets allows building images for unsupported devices; however, these images may require additional device-specific modifications to become bootable.
The target for a system is set by the target property in the system declaration.
For supported devices and the required targets, checkout the documentation on Supported Devices.
Currently, Rugix Bakery supports the following targets:
generic-grub-efi: A generic target that uses Grub as the bootloader and produces an image bootable on any EFI-compatible system. This is the right target for commodity AMD64 and ARM64 hardware and VMs.rpi-tryboot: Raspberry Pi-specific target that uses thetrybootfeature of Raspberry Pi’s firmware. This is the right target for the Raspberry Pi 4 and 5 family of devices. Note that for Raspberry Pi 4 a recent firmware is required.rpi-uboot: Raspberry Pi-specific target that uses U-Boot. This is the right target for older Raspberry Pi models.
Note that specific and generic targets result in images with a bootloader, however, to actually boot the operating system additional configurations may be required. To this end, the following recipes can be used:
core/debian-grub-setup: For Debian withgeneric-grub-efi.core/alpine-grub-setup: For Alpine withgeneric-grub-efi.core/rpi-debian-setup: For Debian withrpi-tryboot.core/rpi-alpine-setup: For Alpine withrpi-tryboot.core/rpi-raspios-setup: For Raspberry Pi OS withrpi-trybootorrpi-uboot.
Image Layouts
Usually, you do not need to worry about image layouts as Rugix Bakery automatically selects a suitable layout based on the system target. For advanced use cases or devices that are not officially supported, Rugix Bakery also gives you the flexibility to configure how exactly the image should be built. Currently, this is limited to creating partitions with optional filesystems.
Image Creation Process
The predefined pipeline creates an image through build rules:
- Build the layer and prepare its release metadata.
- Initialize the target’s bootloader and firmware files.
- Resolve the layout into a disk image containing partition tables and raw firmware.
- Patch the boot configuration with the resolved partition identifiers.
- Create filesystem images from the prepared trees.
- Populate the disk with those filesystem images.
Filesystem archives and software inventories are separate rule outputs. The pipeline includes an update bundle using the same partition artifacts. See repository build rules for how the pipeline connects to the build graph.
Supported partition tables:
gpt: GUID Partition Table (modern partition table, part of the UEFI standard)mbr: MBR Partition Table (legacy partition table, supported by almost any system)
Supported filesystems:
ext4: Ext4 Filesystemfat32: FAT Filesystem. For fixed capacities, the formatter selects FAT12, FAT16, or FAT32 to suit the image size.squashfs: Compressed, read-only SquashFS filesystem.
The image layout is specified in the image.layout section. For details, we refer to the project configuration reference.