Introduction
The Redox OS build system is a sophisticated modular build infrastructure that supports multiple build methods, architectures, and configurations. It orchestrates the compilation of the kernel, userspace applications, and system images through a combination of Makefiles, shell scripts, and Rust-based tools.Build System Architecture
The build system is organized into several key components:Core Components
Makefile System
Modular Makefiles in the
mk/ directory handle different aspects of the build processRecipe System
Cookbook-based package management for building and installing software packages
Configuration
TOML-based configuration files defining system variants and package sets
Bootstrap Scripts
Automated setup scripts for both Podman and native build environments
Makefile Structure
The build system consists of multiple specialized Makefiles:Build Methods
Podman Build (Recommended)
The Podman build method uses containerization to provide a consistent, isolated build environment:
Advantages:
- Consistent build environment across all platforms
- No host system pollution
- Easy to reproduce builds
- Faster setup on systems with package manager support
Native Build
The native build method compiles directly on the host system:
Advantages:
- Direct access to build artifacts
- Faster iteration during development
- Better IDE integration
- Lower memory overhead
Build Targets
Primary Targets
all (default)
all (default)
Builds the complete hard drive image at
build/$(ARCH)/$(CONFIG_NAME)/harddrive.imglive
live
Creates a bootable live ISO image
image
image
Rebuilds the hard drive image from scratch (unmounts first)
rebuild
rebuild
Cleans repo tag and rebuilds everything
Package Management Targets
The build system provides shorthand commands for working with recipes:| Target Pattern | Description | Example |
|---|---|---|
r.PACKAGE | Cook (build) a package | make r.orbital |
c.PACKAGE | Clean a package | make c.kernel |
f.PACKAGE | Fetch package sources | make f.gcc |
p.PACKAGE | Push package to image | make p.shell |
cr.PACKAGE | Clean and rebuild | make cr.relibc |
rp.PACKAGE | Build and push | make rp.nano |
Emulation Targets
Build Artifacts
The build system generates artifacts in thebuild/ directory:
Configuration Variables
Key environment variables that control the build:Target architecture:
x86_64, aarch64, i586, or riscv64gcConfiguration profile:
desktop, server, minimal, etc.Enable (1) or disable (0) Podman-based builds
Use pre-built toolchain binaries (much faster)
Use pre-built package binaries instead of compiling from source
Enable debug symbols and disable stripping
Build Workflow
A typical build follows this workflow:Environment Setup
The build system checks for Podman or native dependencies and sets up the build environment
Toolchain Build
If needed, builds or downloads the cross-compilation toolchain for the target architecture
Recipe Compilation
Processes all recipes defined in the configuration file, building packages in dependency order
Next Steps
Podman Build
Set up a containerized build environment
Native Build
Build directly on your host system
Configuration
Customize your build settings
Recipes
Learn about the recipe system