# RED BEAR OS BUILD SYSTEM — PROJECT KNOWLEDGE BASE **Generated:** 2026-04-12 (P1/P2 complete) · Updated: 2026-06 (source ownership migration) **Toolchain:** Rust nightly (edition 2024) **Architecture:** Microkernel OS in Rust, ~38k files, ~294k LoC Rust **Target Hardware**: AMD64 bare metal, with AMD and Intel machines treated as equal-priority Red Bear OS targets ## OVERVIEW Red Bear OS build system orchestrator — builds and packages ~100+ Git repositories into a bootable Redox image. Uses a Makefile + Rust "cookbook" tool + TOML configs. Languages: Rust (core), C (ported packages), TOML (config), Make (build orchestration). RedBearOS is a **full fork** of Redox OS with direct source ownership. Red Bear maintains its own git forks of every patched component under `local/sources/`. Sources are directly editable — no patches, no indirection. Changes are committed to the appropriate fork repo. Durable Red Bear state belongs in `local/sources/`, `local/recipes/`, `local/docs/`, and tracked Red Bear configs. The current baseline is **Red Bear OS 0.1.0** (Redox snapshot at build-system commit `f55acba68`). ## FULL FORK PRINCIPLE **Red Bear OS is a FULL FORK. We do not depend on Redox. We reuse Redox code only when needed — and when we do, we fork it into our own repos.** This means: | Rule | Explanation | |---|---| | **Own your dependencies** | Every crate and library Red Bear uses must have its source accessible in `local/sources/` or `local/recipes/`. No dependiendo on upstream crates that we cannot fix ourselves. | | **No waiting for upstream** | If a dependency breaks, we fix it in our fork. We do not file issues and wait. | | **Frozen snapshots only** | Upstream Redox is a reference, not a live dependency. We baseline on frozen snapshots and never auto-pull. | | **Upstream gitlab URLs are temporary** | Any recipe pointing at `gitlab.redox-os.org` (91 currently) must eventually be forked to `local/sources/` or pinned to a frozen archive. Exceptions: unmodified upstream packages with pinned revisions. | | **Our code, our fixes** | When crate APIs change (e.g., `libredox 0.1.0` → `0.1.17` broke `call_ro`/`call_wo` signatures), we update OUR fork's code. We don't revert our code to match old APIs — we fix forward. | | **Durable state** | All source modifications are committed to `local/sources//`. No edits in `recipes/*/source/` survive a rebuild. | **Concretely:** - `local/recipes/drivers/redox-driver-sys/` is OUR fork. We fix compilation errors there. - `local/sources/kernel/` is OUR kernel. We don't pull from `gitlab.redox-os.org/redox-oskernel`. - If a Cargo dependency breaks, we fork the dependency crate to `local/sources/` and pin our Cargo.toml to our fork. - The Linux kernel in `local/reference/` is read-only reference — never a dependency. ### NO OVERLAY-STYLE PATCHES — DIRECT EDITS ONLY **Hard policy. No exceptions. No "just this once." No "temporary until we fork."** The Red Bear build is a **full fork**, not an overlay on top of Redox. The correct workflow for any change is: | Want to change | Where to do it (DIRECT EDIT) | |---|---| | Change a recipe's build config | Edit `local/recipes///recipe.toml` directly. If the recipe is in upstream `recipes///recipe.toml`, fork it: copy to `local/recipes///recipe.toml` and edit there. | | Change a source file | Edit `local/sources//.rs` directly. | | Add a new package | Create `local/recipes///recipe.toml` directly. | | Change a build script | Edit `local/scripts/