Overview
Porting applications to Redox OS involves creating recipes in the Cookbook system. A recipe is a TOML file that describes how to download, build, and package software for Redox.Before You Start
Prerequisites
- Build system setup and up-to-date (see Build System Reference)
- Familiarity with the target application’s build system
- Understanding of POSIX/Linux APIs
Common Porting Issues
Recipe Structure
Every recipe is stored inrecipes/<category>/<package-name>/recipe.toml. The recipe consists of three main sections:
1. Source Section
Defines where to download the source code from.2. Build Section
Specifies how to compile the application.3. Package Section
Describes runtime dependencies and metadata.Creating a Basic Recipe
Simple Rust Application
For Rust applications hosted on GitLab:- Clones the git repository
- Builds using
cargo build --release - Installs binaries to
/usr/bin
Application with Tarball Source
For applications distributed as tarballs:Always specify
blake3 checksums for reproducible builds.Build Templates
The Cookbook provides several build templates for common build systems.Cargo Template
For Rust projects:cargopath- Path to Cargo.toml if not in rootcargoflags- Additional flags for cargo buildcargopackages- Specific packages to build from workspacecargoexamples- Example binaries to build
Configure Template
For autotools-based projects:CMake Template
For CMake-based projects:Meson Template
For Meson-based projects:Custom Template
For projects requiring custom build scripts:Dependencies
Build Dependencies
Libraries and tools needed during compilation:Development Dependencies
Additional dependencies for building (optional):Runtime Dependencies
Packages required at runtime:Advanced Features
Applying Patches
Store patches in the same directory asrecipe.toml:
Git Sources with Specific Revisions
Using Another Package’s Source
Reuse source from another recipe:Optional Packages
Create multiple packages from one recipe:Build Script Variables
The Cookbook provides several environment variables in build scripts:| Variable | Description |
|---|---|
COOKBOOK_SOURCE | Path to extracted source code |
COOKBOOK_STAGE | Installation staging directory |
COOKBOOK_SYSROOT | Sysroot with dependencies |
COOKBOOK_CARGO | Path to cargo binary |
COOKBOOK_MAKE | Path to make binary |
COOKBOOK_MAKE_JOBS | Number of parallel jobs |
TARGET | Target triple (e.g., x86_64-unknown-redox) |
GNU_TARGET | GNU-style target triple |
Helper Functions
DYNAMIC_INIT- Initialize for dynamic linkingDYNAMIC_STATIC_INIT- Initialize for static/dynamic linkingcookbook_cargo- Standard cargo build and installcookbook_configure- Standard configure, make, installcookbook_meson- Standard meson build
Testing Your Recipe
Build a Single Recipe
Build with Dependencies
Clean and Rebuild
Update Recipe Source
Local Development
Add to.config/<target>/repo.toml:
Common Patterns
Meta Packages
Packages with no source, only dependencies:Complex Build Example
From thebase recipe:
Troubleshooting
Build Failures
- Check relibc for missing POSIX functions
- Verify all dependencies are listed
- Check if patches apply cleanly
- Review build logs in
build/<target>/<recipe>/
Missing Functions
If you encounter undefined references, the function may need to be implemented in:Debug Build
Enable verbose output:Recipe Categories
Organize recipes by category:archives/- Compression toolscore/- Essential system componentsdev/- Development toolsgames/- Games and entertainmentgraphics/- Graphics applicationsgui/- GUI applicationslibs/- Librariesnet/- Network applicationsshells/- Command shellstext/- Text editors and processors
Best Practices
Use Checksums
Always specify
blake3 for tarball sources to ensure reproducible builds.Minimal Dependencies
Only list necessary dependencies to reduce build complexity.
Upstream First
Contribute Redox support upstream when possible instead of maintaining patches.
Test Thoroughly
Build and test your recipe before submitting.
Contributing Recipes
Once your recipe is working:- Test thoroughly on QEMU or real hardware
- Create a merge request to the Redox repository
- Post the MR link in the MRs Matrix room
Read the full Contributing Guide for merge request guidelines.
See Also
- Recipe Format Reference - Detailed recipe TOML format
- Cookbook System - Build system internals
- Build System Reference - Complete build system guide
- Configuration Settings - Configure build options