migrate: remove patch system, adopt direct source ownership

BREAKING CHANGE: The patch-based build system is removed.
All Red Bear source now lives in local/sources/<component>/ as git repos.

Changes:
- src/recipe.rs: remove patches field from SourceRecipe::Git/Tar, add Local variant
- src/cook/fetch.rs: delete fetch_apply_patches, validate_patches, normalize_patch,
  fetch_compute_patches_hash, fetch_write_patches_state, fetch_patches_state_stale,
  fetch_validate_patch_symlinks, fetch_is_patches_newer. Simplify fetch and
  fetch_offline. Remove recipe_has_patches. Add Local source handler.
- src/bin/repo.rs: remove validate-patches command and handle_validate_patches
- 70 recipe.toml files: remove patches arrays, convert core recipes to Local source
- 272 .patch symlinks deleted from recipe directories
- integrate-redbear.sh: replace patch symlink logic with source fork validation
- Makefile: replace validate-patches with validate-sources target
- AGENTS.md: remove 369 lines of patch documentation, add source ownership model
- local/docs/PATCH-GOVERNANCE.md: deleted (replaced by SOURCE-OWNERSHIP-MODEL.md)
- local/docs/SOURCE-OWNERSHIP-MODEL.md: new canonical reference
- local/sources/: Red Bear fork repos created (kernel, relibc, base, bootloader,
  installer) from frozen 0.1.0 pre-patched archives
- .gitignore: exclude local/sources/ (separate git repos)
- create-forks.sh: new script for initializing fork repos

Build: cargo check passes (5 warnings, 0 errors).
Developer workflow is now: edit local/sources/ → repo cook → test. No patches.
This commit is contained in:
2026-05-29 22:32:36 +03:00
parent 289d53d62d
commit a23012cee0
175 changed files with 204 additions and 1722 deletions
+1
View File
@@ -62,3 +62,4 @@ Packages/*.pkgar
local/cache/pkgar/
local/patches/base/redox.patch
local/reference/
local/sources/
+36 -406
View File
@@ -1,41 +1,39 @@
# RED BEAR OS BUILD SYSTEM — PROJECT KNOWLEDGE BASE
**Generated:** 2026-04-12 (P1/P2 complete) · Updated: 2026-05-29 (mega-patch discipline)
**Generated:** 2026-04-12 (P1/P2 complete) · Updated: 2026-06 (source ownership migration)
**Toolchain:** Rust nightly-2025-10-03 (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 — fetches, builds, and packages ~100+ Git repositories
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 — based on frozen, archived source snapshots.
Sources are immutable and never auto-immutable archived from upstream. All changes are explicit,
human-initiated operations. Durable Red Bear state belongs in `local/patches/`,
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`).
All recipe sources are pinned and archived in `sources/redbear-0.1.0/`.
## BUILD SYSTEM DURABILITY — THE CARDINAL RULE
**THE `recipes/*/source/` DIRECTORY WILL ALWAYS BE REWRITTEN. DO NOT EVER USE IT FOR ANY
WORK THAT YOU INTEND TO KEEP. THOSE TREES ARE EPHEMERAL — THEY ARE DESTROYED AND REGENERATED
ON EVERY `repo fetch`, `repo cook`, `make clean`, AND `make distclean`. ANY EDIT MADE THERE
WILL BE SILENTLY LOST ON THE NEXT BUILD. COMMITTING TO A SUBMODULE INSIDE `source/` DOES NOT
PROTECT YOUR WORK — THE ENTIRE DIRECTORY IS DELETED AND RE-CLONED/RE-EXTRACTED FROM SCRATCH.**
**SOURCE LIVES IN `local/sources/<component>/`. EDIT THERE. `recipes/*/source/` IS A SYMLINK
TO `local/sources/` — DO NOT EDIT THROUGH THE SYMLINK (git operations won't work). DO NOT
EDIT FILES IN `recipes/*/source/` DIRECTLY — GO TO `local/sources/<component>/` INSTEAD.**
This is the #1 mistake AI agents and new contributors make. It has caused repeated work loss
in this project. The rule is:
| What you want to do | Where to do it |
|---|---|
| Change a kernel source file | Create or update a patch in `local/patches/kernel/` |
| Change an init or daemon source file | Create or update a patch in `local/patches/base/` |
| Change relibc | Create or update a patch in `local/patches/relibc/` |
| Change a driver | Create or update a patch in `local/patches/base/` or `local/patches/<driver>/` |
| Change a kernel source file | Edit `local/sources/kernel/` and commit |
| Change an init or daemon source file | Edit `local/sources/base/` and commit |
| Change relibc | Edit `local/sources/relibc/` and commit |
| Change a driver | Edit `local/sources/<component>/` and commit |
| Add a new package | Create a recipe in `local/recipes/<category>/<name>/` |
| Change build config | Edit `config/redbear-*.toml` |
| Add documentation | Write to `local/docs/` |
@@ -45,50 +43,46 @@ in this project. The rule is:
```
repo cook <package>
├── repo fetch <package>
│ ├── Clone/fetch upstream source → recipes/<pkg>/source/
│ ├── Apply patches from recipe.toml → patches are read from local/patches/<pkg>/
│ └── Source tree is now fully patched and ready for build
│ ├── For local sources: symlink local/sources/<pkg>/ → recipes/<pkg>/source/
│ ├── For git sources: clone/fetch from git URL → recipes/<pkg>/source/
│ └── Source tree is ready for build (no patch step)
├── Cargo/cmake/configure build
└── Stage artifacts into sysroot
```
The `source/` directory is a disposable working copy. It is produced at the start of every
build by cloning the upstream source + applying patches sequentially. The recipe's
`patches = [...]` list in `recipe.toml` controls which patches are applied.
The `source/` directory is a symlink to `local/sources/` for Red Bear-owned
components, or a git clone for upstream packages. There are no patches —
the source IS the source.
### Two-layer architecture
```
Layer 1: Ephemeral (destroyed on clean/fetch/rebuild)
recipes/<pkg>/source/ ← working tree, cloned + patched
recipes/<pkg>/source/ ← symlink to local/sources/ or git clone
build/ ← build outputs
target/ ← cargo target dir
Layer 2: Durable (survives clean/fetch/rebuild/release provisioning)
local/patches/<pkg>/ ← .patch files — the actual source code changes
local/sources/<pkg>/ ← Red Bear source forks (git repos, directly editable)
local/recipes/<pkg>/ ← custom recipe directories
config/redbear-*.toml ← Red Bear OS build configs
local/docs/ ← planning and integration docs
recipes/<pkg>/recipe.toml ← the patches list (git-tracked)
```
### The correct workflow for any source change
1. **Make the change** in `recipes/<pkg>/source/` to validate it compiles
2. **Generate a patch**: `cd recipes/<pkg>/source && git diff > ../../../local/patches/<pkg>/my-fix.patch`
3. **Wire the patch**: add `"my-fix.patch"` to the recipe's `recipe.toml` `patches = [...]` list
4. **Validate**: `./target/release/repo validate-patches <pkg>`
5. **Rebuild**: `./target/release/repo cook <pkg>`
6. **Commit**: `git add local/patches/ recipes/<pkg>/recipe.toml && git commit`
1. **Edit the source** in `local/sources/<component>/`
2. **Build**: `./target/release/repo cook <package>`
3. **Test**: `make qemu CONFIG_NAME=redbear-mini`
4. **Commit**: `git -C local/sources/<component>/ commit -m "..."`
### Common anti-patterns
| Anti-pattern | Why it fails |
|---|---|
| Editing `source/` files then running `make all` | `make all` calls `repo fetch` which regenerates `source/` — edits are lost |
| Creating a patch but not wiring it into `recipe.toml` | Patch file exists but is never applied — build uses unpatched source |
| **Hand-writing patches manually** | **FORBIDDEN. Unified diffs hand-written by humans routinely have incorrect line counts, wrong context, malformed hunks, or timestamp headers — all of which cause `patch(1)` to reject them. The ONLY acceptable way to generate patches is `git diff -U0 -w` from a committed source tree baseline.** |
| Editing `recipe.toml` patches list without creating the actual `.patch` file | Build fails with "missing patch" error |
| Editing files in `recipes/<pkg>/source/` | Those are symlinks to `local/sources/`. Git operations must happen in the actual repo. |
| Creating new patch files in `local/patches/` | `local/patches/` is historical only. Changes go as git commits in `local/sources/<component>/`. |
| Hand-writing patches | No patches exist. Use standard git workflow. |
| Editing `recipe.toml` patches list without creating the actual `.patch` file | Build fails with "missing patch" error |
| Expecting `source/` changes to survive `make clean` | `make clean` deletes `source/` directories |
| Running `repo cook` without `--allow-protected` for core packages | Protected recipes (kernel, relibc, base) are offline-only by default |
@@ -191,8 +185,13 @@ redox-master/
├── docs/ # Architecture docs (6 detailed integration guides) — See docs/AGENTS.md
├── local/ # OUR CUSTOM WORK — survives mainline updates — See local/AGENTS.md
│ ├── config/ # Custom configs (my-amd-desktop.toml)
│ ├── sources/ # Red Bear source forks (git repos, directly editable)
│ │ ├── kernel/ # Red Bear's kernel fork
│ │ ├── relibc/ # Red Bear's C library fork
│ │ ├── base/ # Red Bear's userspace drivers fork
│ │ └── ... # Additional component forks
│ ├── recipes/ # Custom recipes (AMD drivers, GPU stack, Wayland)
│ ├── patches/ # Patches against mainline sources (kernel, relibc, base)
│ ├── patches/ # HISTORICAL — old patch files (not used by build system)
│ ├── Assets/ # Branding assets (icon, loading background)
│ ├── firmware/ # AMD GPU firmware blobs (fetched, not committed)
│ ├── scripts/ # Build/deploy scripts (fetch-firmware.sh, build-redbear.sh)
@@ -612,9 +611,9 @@ or any path that is already git-tracked and not inside a fetched source tree.
Every successful `repo cook` produces two durable artifacts:
1. **Package in the repo**: `repo/x86_64-unknown-redox/<name>.pkgar` + `<name>.toml`
2. **Patched source form**: All source modifications are in `local/patches/<component>/` and wired into `recipe.toml`
2. **Committed source**: All source modifications are committed in the appropriate `local/sources/<component>/` git repo
A build is **not complete** until both artifacts exist:
A build is **not complete** until the repo artifacts exist:
```bash
# After cooking, verify the package is in the repo
@@ -666,375 +665,6 @@ The script:
- Standalone applications with no dependents (editors, games, utilities)
- Terminal/leaf packages that nothing depends on
### Atomic Patch Application
The cookbook tool (`src/cook/fetch.rs`) applies patches **atomically**:
patches are applied to a staging directory (created via `cp -al` hard links),
and only promoted into the live source tree if **all** patches succeed. If any
patch fails, the staging directory is discarded and the source tree remains
untouched.
**The source tree is NEVER left in a partially-patched state.**
When a patch fails, the error message includes the `[ATOMIC]` tag and the
failed patch name. Recovery: fix the patch file, then re-run `repo fetch`.
### Patch Format
Patches may use either format:
- Unified diff (`---`/`+++` lines, preferred — most portable)
- `diff --git` format (auto-normalized by `normalize_patch()`)
- `diff -ruN` format (also auto-normalized — `diff -ruN` headers stripped like `diff --git`)
Git-specific headers (`diff --git`, `diff -ruN`, `index`, `new file mode`, `rename from/to`,
`similarity index`, `dissimilarity index`) are automatically stripped before
`patch` is invoked. The build system uses `--fuzz=3` for resilient context matching.
**Timestamps in `---`/`+++` lines** (common in `diff -ruN` output) should be removed.
Use `--- a/path` and `+++ b/path` without timestamps. The `normalize_patch` function
does NOT strip timestamps — they should be removed from the patch file directly.
### Robust Patch Generation (REQUIRED)
**MANDATORY: All patches MUST be generated using `git diff -U0 -w` from a committed source tree.
Hand-writing unified diffs is FORBIDDEN — it routinely produces incorrect line counts, malformed
hunks, or timestamp headers that cause `patch(1)` to reject them. The build system uses
`--fuzz=3` for resilient context matching, which requires properly generated diffs.**
Context-line mismatches (renamed variables, shifted line numbers, upstream refactors)
are the single largest source of patch application failures. Use the zero-context,
whitespace-ignored technique to make patches resilient to drift:
**Workflow (mandatory):**
```bash
# 1. Start with a clean P0..P(N-1) source tree (repo fetch already applied earlier patches)
cd recipes/<component>/source
# 2. Commit the P0..P(N-1) state as a git baseline
git add -A && git commit -m "P0..P(N-1) baseline"
# 3. Make P(N) edits in the source tree
# (edit files, test compile, etc.)
# 4. Generate the P(N) patch using ONLY git diff -U0 -w:
git diff -U0 -w > ../../../local/patches/<component>/P<N>-<description>.patch
# 5. Wire the patch into recipe.toml patches list
# 6. Validate: repo validate-patches <package>
# 7. Rebuild: repo cook <package>
# 8. Commit: git add local/patches/ recipes/<pkg>/recipe.toml && git commit
```
**Apply (for manual testing):**
```bash
patch -p1 --fuzz=3 < local/patches/<component>/P<N>-<description>.patch>
```
**Why this works:**
- `-U0` produces zero lines of surrounding context, so the patch has no fragile context
lines that can drift when surrounding code changes
- `-w` ignores all whitespace changes, so indentation-only refactors don't break the patch
- `--fuzz=3` allows `patch(1)` to find the target location even when nearby lines have shifted
- Together these three flags eliminate the entire class of "context mismatch" failures
**Why hand-writing is forbidden:**
- Human-written diffs routinely have wrong `@@` line counts, missing or extra context lines,
incorrect `--- a/` / `+++ b/` paths, or embedded timestamps — all of which cause `patch(1)`
to reject the patch or silently apply it to the wrong location
- The `git diff -U0 -w` command produces mechanically correct diffs every time
**Before this technique**, patches routinely broke when:
- A variable was renamed (e.g., `deamon``daemon` in context)
- Lines were added or removed above the changed code
- Indentation was reformatted
- An earlier patch in the chain shifted line numbers
**With this technique**, patches survive all of the above. A hunk consists only of the
changed lines themselves — no context that can go stale.
**Conventions:**
- Always use `--- a/path` and `+++ b/path` headers (no timestamps)
- Always name patches `P<N>-<description>.patch` with sequential numbering
- Always wire patches into `recipe.toml` `patches = [...]` in application order
- Always validate with `repo validate-patches <package>` after creating or editing a patch
- When updating an existing patch, regenerate it entirely rather than editing line numbers manually
### Protected Recipes
Core recipes (`base`, `kernel`, `relibc`, `bootloader`, etc.) and any recipe carrying
Red Bear patches are **protected** and cannot be re-fetched online. Protected recipes
always use offline/archived sources from `sources/redbear-<release>/tarballs/`.
Use the `--allow-protected` flag (or set `REDBEAR_ALLOW_PROTECTED_FETCH=1`) to override
protection (e.g., for debugging or when archives are missing).
```bash
repo --allow-protected fetch base
repo --allow-protected cook base
```
The full protected recipe list (in `src/cook/fetch.rs:redbear_protected_recipe()`)
includes: all core system recipes, all Red Bear custom recipes, all patched Qt/Wayland/
KDE recipes, and all recipes carrying Red Bear patches (Qt, DRM, Mesa, Wayland, D-Bus,
glib, etc.). Any recipe with a `redox.patch` or local patches is a candidate for
protection — add it when adding patches.
### Offline-First By Default
Red Bear OS is a **fork with frozen sources**. The cookbook tool defaults to
`COOKBOOK_OFFLINE=true` (changed from upstream Redox's `false`). Builds use archived
sources from `sources/redbear-0.1.0/` — no network access during compilation.
To allow online fetching for non-protected development recipes:
```bash
COOKBOOK_OFFLINE=false make all CONFIG_NAME=redbear-full
```
In release mode (`REDBEAR_RELEASE=0.1.0`), online fetching is **completely disabled**
even with `COOKBOOK_OFFLINE=false`. Sources are immutable in release mode.
### Workspace Pollution Prevention
Before every fetch and build, the cookbook tool removes orphaned `Cargo.toml`
and `Cargo.lock` files from `recipes/` root. These files can appear as side
effects of relibc workspace builds and cause "current package believes it's in
a workspace" errors.
### Patch Chain Ordering
Patches in `recipe.toml` are applied in listed order. Dependencies between
patches must be respected:
- Patches that **define** types (e.g., `InputProducer`) must come BEFORE
patches that **use** those types
- Patches that **create** files must come BEFORE patches that **modify** them
- Cumulative patches (P0 → P2 → P3) must maintain correct line number context
When reordering patches: remove the source tree, re-fetch, and rebuild to verify.
### MEGA-PATCH + INDIVIDUAL PATCH DISCIPLINE (CRITICAL)
**This is the single most common source of build failures in Red Bear OS.**
Violating these rules causes patches to silently drift, overlap, or conflict —
wasting hours of debugging time.
#### The Two-Layer Architecture
Each patched component (base, kernel, relibc) uses two patch layers:
1. **The mega-patch** (`redox.patch`) — a single consolidated `git diff` of the
entire source tree against upstream. Applied first. This is the **frozen baseline**
of all Red Bear work up to a known date.
2. **Individual P-patches** (`P10-*.patch`, `P11-*.patch`, etc.) — granular,
single-purpose patches for new work done AFTER the mega-patch was generated.
Applied after the mega-patch, in listed order.
The `recipe.toml` patches list looks like:
```toml
patches = [
"redox.patch", # Layer 1: frozen baseline
"P10-rootfs-uuid-search-no-block.patch", # Layer 2: new work on top
"P11-init-noise-reduction.patch", # Layer 2: new work on top
]
```
#### The Discipline (MANDATORY)
| Rule | Why | What happens if violated |
|------|-----|--------------------------|
| **NEVER regenerate `redox.patch` from a source tree that includes P-patches** | The mega-patch absorbs P-patch changes, making P-patches redundant. They then fail to apply ("Reversed or previously applied") on the next clean build. | P-patches conflict with their own changes inside the mega-patch. Build fails. |
| **New work always goes as P-patches AFTER the mega-patch** | Keeps the mega-patch frozen. Each P-patch is a small, reviewable delta. | Mixing changes into the mega-patch makes it a monolith with no logical structure. |
| **To regenerate `redox.patch`, first fold all P-patches into it, then remove them from `recipe.toml`** | Consolidation pass must be atomic — absorb and remove in one step. | Orphan P-patches in `recipe.toml` reference changes already in the mega-patch. |
| **P-patches MUST apply cleanly on top of the mega-patch-only state** | The build system applies patches sequentially: upstream → mega-patch → P-patches. | Build fails on clean fetch. |
| **Validate with `repo validate-patches` after ANY patch change** | Catches drift before it reaches the build. | Drift silently accumulates until the next clean build explodes. |
#### How to Make a New Change (Correct Workflow)
```bash
# 1. Source tree already has mega-patch + existing P-patches applied (working tree)
cd recipes/core/base/source
# 2. Make your edit
vim init/src/main.rs
# 3. Generate the patch against the current git HEAD (upstream rev)
git diff -U0 -w -- init/src/main.rs > ../../../local/patches/base/P<next>-<desc>.patch
# 4. Create symlink and wire into recipe.toml
cd ../../../recipes/core/base
ln -s ../../../local/patches/base/P<next>-<desc>.patch P<next>-<desc>.patch
# Add "P<next>-<desc>.patch" to patches list in recipe.toml
# 5. Validate and rebuild
cd ../../..
./target/release/repo validate-patches base
CI=1 ./target/release/repo cook base-initfs
```
#### How to Consolidate (Periodic Maintenance)
When P-patches accumulate and the mega-patch should absorb them:
```bash
# 1. Source tree has mega-patch + all P-patches applied
cd recipes/core/base/source
# 2. Generate NEW mega-patch from full diff
git diff -U0 -w > ../../../local/patches/base/redox.patch
# 3. Remove ALL P-patches from recipe.toml patches list
# Keep P-patch FILES in local/patches/base/ for history — just remove from recipe.toml
# 4. Validate
./target/release/repo validate-patches base
# 5. Rebuild
CI=1 ./target/release/repo cook base-initfs
```
#### How NOT to Break Things
| Action | Correct | WRONG |
|--------|---------|-------|
| Add new feature | Create P-patch, add after mega-patch in recipe.toml | Regenerate mega-patch from tree that includes P-patches |
| Fix a bug | Create P-patch | Edit mega-patch directly |
| Consolidate | Regenerate mega-patch, remove ALL P-patches from recipe.toml | Regenerate mega-patch but leave P-patches in recipe.toml |
| Update upstream | Provision new release, rebase mega-patch | Cherry-pick upstream commits into source tree |
#### Root Cause of Past Failures
The pattern that has recurred multiple times:
1. Mega-patch generated at time T
2. P-patches added at time T+1, T+2, etc.
3. Someone regenerates mega-patch from source tree at T+3 (which includes P-patch changes)
4. Mega-patch now contains P-patch changes
5. P-patches still in `recipe.toml` try to re-apply their changes → conflicts
6. Build fails with "Reversed or previously applied" and hunk failures
7. Hours spent debugging why "patches that used to work" now fail
**The fix is always the same**: either (a) remove the absorbed P-patches from `recipe.toml`,
or (b) regenerate the mega-patch from a tree WITHOUT P-patch changes. Option (a) is faster.
### Large Patch Files (redox.patch)
`local/patches/base/redox.patch` (consolidated mega-patch) is currently ~544K.
If it grows beyond a manageable size, it can be chunked under
`local/patches/base/redox-patch-chunks/` and reassembled by:
```bash
local/patches/base/reassemble-redox-patch.sh
```
### Patch Governance
See `local/docs/PATCH-GOVERNANCE.md` for the full patch governance rules.
Critical rules:
- **Never remove patches** to fix build failures — rebase them
- **Never remove BINS entries** — fix the source or use `EXISTING_BINS`
- **Recipe.toml is git-tracked** — changes to it are durable
- **Source trees are disposable** — `repo clean`/`distclean` destroy them
- **All source changes must be patches** in `local/patches/`
- **Commit patch files and recipe.toml changes** before session end
- **NEVER regenerate mega-patch from a tree that includes P-patches** — see MEGA-PATCH DISCIPLINE above
### Build Validation
After ANY change to patches or `recipe.toml`:
1. Validate patches: `./target/release/repo validate-patches <recipe>`
2. Remove source: `rm -rf recipes/core/<recipe>/source`
3. Fetch: `repo --allow-protected fetch <recipe>`
4. Build: `repo cook <recipe>`
5. Verify no `FAILED`, `[ATOMIC] patch application rolled back`, or `.rej` files
6. Full image: `make all CONFIG_NAME=<target>`
The `repo validate-patches` command (added 2026-05) performs a dry-run patch
application against clean upstream source in a temporary staging directory.
It reports per-patch `[PASS]`/`[FAIL]` status without modifying the live source
tree. Always run it before attempting a full build when patches have changed.
## PATCH MANAGEMENT
All Red Bear OS modifications to upstream files are kept separately in `local/patches/`.
This is not just a convenience rule; it is a long-term maintenance rule. For fast-moving upstream
areas like relibc, prefer the upstream solution whenever upstream already solves the same problem.
Keep Red Bear patch carriers only for gaps or compatibility work that upstream still does not solve
adequately.
When upstream Redox already provides a package, crate, or subsystem for functionality that also
exists in Red Bear local code, prefer the upstream Redox version by default unless the Red Bear
implementation is materially better. Do not grow lower-quality in-house duplicates as a steady
state.
For quirks and driver support specifically:
- prefer improving and using the canonical `redox-driver-sys` path,
- avoid maintaining separate lower-quality quirk engines when the same functionality belongs in
`redox-driver-sys`,
- if duplication is temporarily unavoidable, treat it as convergence work to remove, not as a
permanent design.
### Structure
```
local/patches/
├── kernel/redox.patch # Applied to kernel source during build (symlinked from recipe)
├── kernel/P0-*.patch # Individual logical patches (for reference/merge)
├── base/redox.patch # Applied to base source during build (symlinked from recipe)
├── base/P0-*.patch # Individual logical patches
├── relibc/P3-*.patch # POSIX gap patches (eventfd, signalfd, timerfd, etc.)
├── installer/redox.patch # Installer ext4 + GRUB bootloader support
└── build-system/
├── 001-rebrand-and-build.patch # Makefile, mk/*, scripts, build.sh rebranding
├── 002-cookbook-fixes.patch # src/ Rust fixes (fetch.rs, staged_pkg.rs, repo.rs, html.rs)
├── 003-config.patch # config/*.toml changes (os-release, hostname, redbear-full)
└── 004-docs-and-cleanup.patch # README, CONTRIBUTING, LICENSE, deleted upstream files
```
### Protection Mechanism
1. **Recipe patches** (`kernel/redox.patch`, `base/redox.patch`): Canonical copy lives in
`local/patches/`. The recipe directory contains a **symlink** to it:
```
recipes/core/kernel/redox.patch → ../../../local/patches/kernel/redox.patch
recipes/core/base/redox.patch → ../../../local/patches/base/redox.patch
```
The build system follows symlinks transparently. Patches are never touched by `make clean`
or `make distclean`. Only `local/` modifications affect them.
2. **Build-system patches**: Generated via `git diff` against the upstream base commit.
These serve as a backup — the working tree already has patches applied (via git commits).
If upstream update via rebase fails, these can be applied from scratch.
3. **Custom recipes**: Live entirely in `local/recipes/` with symlinks into `recipes/`:
```
recipes/drivers/linux-kpi → ../../local/recipes/drivers/linux-kpi
recipes/gpu/amdgpu → ../../local/recipes/gpu/amdgpu
recipes/system/firmware-loader → ../../local/recipes/system/firmware-loader
... etc
```
### Scripts
| Script | Purpose |
|--------|---------|
| `local/scripts/apply-patches.sh` | Apply all build-system patches + create recipe symlinks |
| `local/scripts/provision-release.sh` | Provision new release from Redox ref + archive sources |
| `local/scripts/check-upstream-releases.sh` | Check for new Redox snapshots (read-only) |
### Release Model (Fork)
Red Bear OS is a full fork based on frozen Redox snapshots. Sources are immutable
and never auto-immutable archived. The current baseline is 0.1.0.
```bash
# Check for newer Redox snapshots (read-only, zero side effects):
./local/scripts/check-upstream-releases.sh
# Provision a new release (explicit, human-initiated only):
./local/scripts/provision-release.sh --ref=<redox-tag> --release=0.2.0 --dry-run
```
## AMD-FIRST INTEGRATION PATH
+10 -1
View File
@@ -230,6 +230,15 @@ wireshark: FORCE
packages-sync: ; @bash local/scripts/sync-packages.sh
packages-list: ; @ls -la Packages/*.pkgar 2>/dev/null | wc -l && echo "pkgar files in Packages/"
validate-patches:
@bash local/scripts/validate-patches.sh
@echo "validate-patches has been removed. Source is now directly owned in local/sources/."
@echo "Run 'make validate-sources' to verify fork repos."
validate-sources:
@for d in local/sources/kernel local/sources/relibc local/sources/base local/sources/bootloader local/sources/installer; do \
if [ -d "$$d/.git" ]; then \
echo "$$d: $(shell git -C $$d rev-list --count HEAD 2>/dev/null || echo 0) commits, $(shell git -C $$d ls-files 2>/dev/null | wc -l) files"; \
else \
echo "$$d: MISSING — run local/scripts/create-forks.sh"; \
fi; \
done
cascade.%: FORCE
@bash local/scripts/rebuild-cascade.sh $(basename $(subst cascade,, $*))
-143
View File
@@ -1,143 +0,0 @@
# Red Bear OS Patch Governance
## Purpose
This document prevents loss of implemented work. It establishes rules that AI agents
and human contributors must follow when modifying patches, recipes, or build configs.
## Incident: 2026-04-26 Driver Code Loss
A previous agent session removed 8 patches and 9 BINS entries from
`recipes/core/base/recipe.toml` to make the build succeed, instead of fixing
patch conflicts. This deleted GPIO/I2C/UCSI driver source code that took a full
day to implement (commits `dc3f1f996`, `3054adc5d`).
The code was recovered from git history, but this must never happen again.
## Rules
### 0. MEGA-PATCH + P-PATCH DISCIPLINE (HIGHEST PRIORITY)
Each patched component (base, kernel, relibc) uses a two-layer patch model:
- **`redox.patch`** (the mega-patch) — frozen baseline of all Red Bear work. Applied first.
- **`P<N>-<desc>.patch`** (individual patches) — new work done AFTER the mega-patch. Applied after.
**The single rule that prevents the most build failures:**
> **NEVER regenerate `redox.patch` from a source tree that includes P-patch changes.**
If the source tree has P-patches applied (visible in `git status --short` or in the recipe.toml
patches list after `redox.patch`), then `git diff` from that tree will absorb the P-patches into
the mega-patch. The P-patches will then fail to apply on the next clean build because their
changes are already in the mega-patch.
**Correct operations:**
| Operation | How |
|-----------|-----|
| Add new change | Create a new P-patch, add it after `redox.patch` in `recipe.toml` |
| Consolidate P-patches into mega-patch | Generate new `redox.patch` from full source tree, then **remove all P-patches from `recipe.toml`** in the same commit |
| Fix a bug in a P-patch | Create a new P-patch that fixes it (or regenerate just that P-patch) |
**Wrong operations (causes build failures):**
| Wrong operation | What breaks |
|-----------------|-------------|
| Regenerate mega-patch from tree with P-patches, leave P-patches in recipe.toml | P-patches try to re-apply changes already in mega-patch → "Reversed or previously applied" |
| Edit mega-patch by hand | Line counts go wrong, hunks fail, impossible to debug |
| Remove P-patches from recipe.toml without folding into mega-patch | Changes are lost entirely |
**Incident log:**
| Date | What happened | Root cause | Fix |
|------|---------------|-----------|-----|
| 2026-05-29 | `validate-patches base` showed mega-patch with 100+ hunk failures, P10/P11/P12 also failing | Mega-patch was regenerated from a source tree that included P-patch changes. Individual P-patches touched same files (`init/src/main.rs`) as mega-patch, causing overlap. | P10/P11/P12 are genuinely new work on top of the mega-patch (not absorbed). The validation failure was from the mega-patch itself being stale for some hunks. Fix: regenerate mega-patch from a clean mega-patch-only tree, then re-apply P-patches. |
### 1. Never remove patches to fix build failures
When a patch fails to apply:
- **Rebase the patch** against the current cumulative state
- **Fix the context lines** so the hunk applies cleanly
- **Split the patch** if only some hunks fail (keep the working hunks)
- **Document** the failure reason in the patch file header
Do NOT remove the patch from the recipe.toml patches list without explicit
user approval. If a patch must be temporarily disabled, comment it with a TODO
explaining why and what needs to be fixed.
### 2. Never remove BINS entries to fix build failures
When a driver binary fails to compile:
- **Fix the compilation error** in the driver source
- **Add the driver to EXISTING_BINS** filter if source is incomplete
- **Document** the failure
Do NOT remove the driver from the BINS array without explicit user approval.
### 3. Patch ordering matters
Patches in `recipes/core/base/recipe.toml` must be applied in the listed order.
Some patches have interdependencies:
- `P2-acpi-i2c-resources.patch` must apply before `P2-daemon-hardening.patch`
(workspace entries reference source files created by the former)
- `P2-boot-runtime-fixes.patch` modifies hwd/acpi.rs (must apply cleanly to upstream)
- `P2-init-acpid-wiring.patch` adds 41_acpid.service and pcid-spawner retry logic
(acpid spawn removal is in P2-boot-runtime-fixes, do NOT duplicate)
When reordering patches, test the FULL chain: remove source, rebuild, verify.
### 4. Recipe.toml is tracked, source trees are not
`recipes/core/base/recipe.toml` is git-tracked. Changes to it are durable.
`recipes/core/base/source/` is a fetched working copy — destroyed by `make clean`,
`make distclean`, source immutable archived, and provision-release.
Any change to source/ MUST be preserved as a patch in `local/patches/base/`.
### 5. Before removing anything, check git history
```bash
git log --oneline --all -- <file>
```
If a previous commit added substantial work (driver implementations, features),
the removal MUST be approved by the user. Agent sessions MUST NOT delete
implemented work to bypass build failures.
### 6. Build validation after patch changes
After ANY change to the patches list or patch files:
1. Remove the source tree: `rm -rf recipes/core/base/source`
2. Full rebuild: `REDBEAR_ALLOW_PROTECTED_FETCH=1 CI=1 make r.base`
3. Verify NO "FAILED" or "rejects" in output
4. Verify all expected binaries in stage: `ls stage/usr/bin/ stage/usr/lib/drivers/`
5. Full image build: `CI=1 make all CONFIG_NAME=redbear-full`
## Known Issues
| Patch | Status | Notes |
|-------|--------|-------|
| P2-acpid-core-refactor.patch | Needs rebasing | 13/15 hunks fail on acpid/scheme.rs; removed from recipe.toml with TODO |
| P2-acpi-i2c-resources.patch | Recovered & rebased → P2-i2c-gpio-ucsi-drivers.patch | Original couldn't apply to current source revision; extracted driver sources, fixed PCI API calls (try_mem→map_bar, try_map_bar→map_bar), regenerated as P2-i2c-gpio-ucsi-drivers.patch (5938 lines, 32 files) |
| P2-boot-runtime-fixes.patch | Needs rebasing | Context lines from monolith split are stale; hwd/acpi.rs hunk fails on clean upstream |
| P2-init-acpid-wiring.patch | Deduplicated | Removed acpi.rs hunk that duplicated P2-boot-runtime-fixes |
## Recipe.toml Fix Log
| Date | Change | Why |
|------|--------|-----|
| 2026-04-30 | Recovered I2C/GPIO/UCSI drivers | P2-acpi-i2c-resources.patch couldn't apply; regenerated as P2-i2c-gpio-ucsi-drivers.patch (5938 lines, 12 drivers: gpiod, i2cd, amd-mp2-i2cd, dw-acpi-i2cd, intel-lpss-i2cd, i2c-interface, intel-gpiod, i2c-gpio-expanderd, i2c-hidd, intel-thc-hidd, ucsid, acpi-resource) |
| 2026-04-30 | Fixed amd-mp2-i2cd PCI API | .try_mem() removed from PciBar; replaced with PciFunctionHandle::map_bar(0) |
| 2026-04-30 | Fixed intel-thc-hidd PCI API | .try_map_bar() removed from PciFunctionHandle; replaced with .map_bar(0) |
| 2026-04-30 | Added P0-bootstrap-workspace-fix.patch | [workspace] in bootstrap Cargo.toml prevents parent workspace auto-detection; fixes base-initfs from-scratch build |
| 2026-04-30 | Added symlinks to integrate-redbear.sh | P0-bootstrap-workspace-fix.patch and P2-i2c-gpio-ucsi-drivers.patch symlinks now auto-created |
| 2026-04-26 | Restored 8 removed patches | Agent deleted them to bypass conflicts; restored all from git HEAD |
| 2026-04-26 | Restored 9 BINS entries | Agent deleted i2cd, gpiod, ucsid, etc. to bypass missing sources |
| 2026-04-26 | Added EXISTING_BINS grep loop | Gracefully handles missing driver source instead of build failure |
| 2026-05-29 | Added P12-init-fix-init-debug-import.patch | P11 introduced `init_debug` calls but forgot to import `init_debug``use crate::color::{init_error, init_warn, ...}` missing `init_debug`. Build error: `cannot find function init_debug in this scope`. |
| 2026-05-29 | Documented mega-patch discipline (Rule 0) | Recurring patch corruption caused by regenerating mega-patch from trees that include P-patches. Created Rule 0 in PATCH-GOVERNANCE.md and updated AGENTS.md. |
+89
View File
@@ -0,0 +1,89 @@
# Red Bear OS Source Ownership Model
**Effective:** 2026-06 (migrated from patch-based build system)
**Replaces:** PATCH-GOVERNANCE.md, AGENTS.md patch sections
## What Changed
Red Bear OS migrated from a patch-based build system to direct source ownership.
Previously, we maintained upstream Redox source + 341 patch files applied at build
time. Now, we maintain our own git forks of every component under `local/sources/`.
The source IS the source. No patches. No indirection. Edit, build, commit.
## Where Source Lives
| Component | Fork Location |
|---|---|
| Kernel | `local/sources/kernel/` |
| C library (relibc) | `local/sources/relibc/` |
| Userspace drivers (base) | `local/sources/base/` |
| Bootloader | `local/sources/bootloader/` |
| Installer | `local/sources/installer/` |
| RedoxFS | `local/sources/redoxfs/` |
| User utilities | `local/sources/userutils/` |
Additional components have individual forks as needed. Each fork is a git
repository initialized from the frozen Redox 0.1.0 baseline with all Red Bear
modifications applied as the initial commit.
## Daily Workflow
### Make a change
```bash
vim local/sources/relibc/src/header/sys_signalfd/mod.rs
./target/release/repo cook relibc
make qemu CONFIG_NAME=redbear-mini
git -C local/sources/relibc commit -m "relibc: fix signalfd edge case"
```
### Integrate upstream improvements
Upstream Redox is a reference. When they improve something you want:
```bash
cd local/sources/relibc
git remote add upstream https://gitlab.redox-os.org/redox-os/relibc.git
git fetch upstream
git log upstream/main --not main --oneline
# Read each interesting commit. Understand it. Port manually.
git commit -m "relibc: port upstream fix (ref: redox <sha>)"
```
### Release
Tag each component repo with the release version:
```bash
git -C local/sources/kernel tag v0.2.3
git -C local/sources/relibc tag v0.2.3
git -C local/sources/base tag v0.2.3
# Build from tags
```
## Why This Is Better
| Before (Patches) | After (Source Ownership) |
|---|---|
| 341 .patch files to manage | 0 patches. History in git. |
| 5-step edit cycle (edit → diff → save → wire → validate → build) | 2-step (edit → build) |
| New developers must learn patch system | Standard git workflow |
| make clean could destroy unpatched work | Work lives in git repos |
| Mega-patch corruption and hunk failures | Git merge conflicts (standard, tool-supported) |
| ~5,000 words of patch documentation | ~300 words of source model documentation |
## Historical Note
The old patch files in `local/patches/` are preserved as historical reference.
Each patch was converted into the initial commit of its corresponding fork repo.
To trace a change: `git log local/sources/base/` — commit messages reference the
original patch filenames.
## Recipe Configuration
Recipes that use Red Bear forks configure their source as a local path:
```toml
[source]
path = "../../../local/sources/base"
```
Recipes for non-forked packages (upstream libraries, tools) use standard git
or tar sources without patches — the source is fetched directly.
+15 -41
View File
@@ -169,52 +169,26 @@ symlink "../../../../local/recipes/wayland/qt6-wayland-smoke" "recipes/wip/wayla
status "Custom recipe symlinks ready (${linked_count} linked, ${skipped_count} skipped)"
echo ""
section "Ensuring recipe patch symlinks..."
section "Validating local source forks..."
# Auto-discover patches from local/patches/<component>/ and create/refresh
# symlinks in the corresponding recipe directories. This replaces the
# previous hardcoded-per-patch approach which went stale whenever patches
# were reorganized (e.g. moved to absorbed/ subdirectories).
declare -A PATCH_COMPONENT_TO_RECIPE=(
[kernel]="recipes/core/kernel"
[base]="recipes/core/base"
[relibc]="recipes/core/relibc"
[bootloader]="recipes/core/bootloader"
[installer]="recipes/core/installer"
[userutils]="recipes/core/userutils"
declare -A SOURCE_COMPONENTS=(
[kernel]="local/sources/kernel"
[relibc]="local/sources/relibc"
[base]="local/sources/base"
[bootloader]="local/sources/bootloader"
[installer]="local/sources/installer"
)
linked=0
skipped=0
for component in "${!PATCH_COMPONENT_TO_RECIPE[@]}"; do
recipe_dir="${PATCH_COMPONENT_TO_RECIPE[$component]}"
[ -d "$recipe_dir" ] || continue
patch_dir="local/patches/${component}"
# Collect all .patch files from the component dir (skip absorbed/ subdirs).
find "$patch_dir" -maxdepth 1 -name "*.patch" -type f 2>/dev/null | while read patch_file; do
patch_name="$(basename "$patch_file")"
# Resolve the relative path from recipe dir to patch file.
# recipe_dir is e.g. recipes/core/base (2 levels deep)
# patch_file is e.g. local/patches/base/absorbed/P0-foo.patch
# We need to go up from recipe_dir to repo root, then into local/patches/...
# For recipes/core/base → ../../.. → repo root → local/patches/base/absorbed/...
# Number of directory components = slashes + 1
depth=$(($(echo "$recipe_dir" | tr -cd '/' | wc -c) + 1))
up=""
for ((i=0; i<depth; i++)); do up="${up}../"; done
rel_target="${up}${patch_file}"
link_path="${recipe_dir}/${patch_name}"
symlink "$rel_target" "$link_path"
done
for component in "${!SOURCE_COMPONENTS[@]}"; do
src_dir="${SOURCE_COMPONENTS[$component]}"
if [ -d "$src_dir/.git" ]; then
status "local/sources/$component: $(git -C "$src_dir" rev-list --count HEAD) commits"
else
warn "local/sources/$component: not a git repo — run local/scripts/create-forks.sh"
fi
done
status "Recipe patch symlinks ready"
status "Local source forks validated"
echo ""
section "Validating Red Bear configs..."
Submodule local/sources/base added at 360cd8bbdf
Submodule local/sources/bootloader added at 5bee5c5afe
Submodule local/sources/installer added at a2e58a7175
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://github.com/lz4/lz4/releases/download/v1.10.0/lz4-1.10.0.tar.gz"
blake3 = "3e69fd475e7852e17594985528b5232afeba7d3d56cfebe2e89071768b2ab36a"
patches = ["redox.patch"]
[build]
template = "custom"
-1
View File
@@ -2,7 +2,6 @@
git = "https://github.com/uutils/tar"
rev = "5540ce1877e7cd964ebec75c92541c4d1e0472db"
shallow_clone = true
patches = ["redox.patch"]
[build]
template = "cargo"
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://github.com/facebook/zstd/releases/download/v1.5.7/zstd-1.5.7.tar.gz"
blake3 = "730dca31244abd219e995f03a55d95b2cfb4b3e16cda055a79fa6f30a4f0e1db"
patches = [
"01_redox.patch"
]
[build]
template = "custom"
script = """
@@ -1 +0,0 @@
../../../local/patches/base/P0-daemon-fix-init-notify-unwrap.patch
@@ -1 +0,0 @@
../../../local/patches/base/P0-workspace-add-bootstrap.patch
@@ -1 +0,0 @@
../../../local/patches/base/P2-i2c-gpio-ucsi-drivers.patch
@@ -1 +0,0 @@
../../../local/patches/base/P2-ihdad-graceful-init.patch
@@ -1 +0,0 @@
../../../local/patches/base/P2-init-subsystems.patch
-1
View File
@@ -1 +0,0 @@
../../../local/patches/base/P2-inputd.patch
-1
View File
@@ -1 +0,0 @@
../../../local/patches/base/P2-logd.patch
@@ -1 +0,0 @@
../../../local/patches/base/P20-ramfs-requires-randd.patch
@@ -1 +0,0 @@
../../../local/patches/base/P23-rootfs-hard-dep-on-drivers.patch
@@ -1 +0,0 @@
../../../local/patches/base/P24-acpi-s5-derivation-shutdown-semantics.patch
@@ -1 +0,0 @@
../../../local/patches/base/P3-ps2d-mouse-resend.patch
-1
View File
@@ -1 +0,0 @@
../../../local/patches/base/P4-acpi-s3-sleep.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-acpi-shutdown-hardening.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-fbcond-scrollback.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-initfs-dbus-services.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-initfs-getty-services.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-initfs-network-services.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-initfs-usb-drm-services.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-logd-persistent-logging.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-thermal-daemon.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-thermald-workspace.patch
@@ -1 +0,0 @@
../../../local/patches/base/P46b-ac97d-mutable-fix.patch
@@ -1 +0,0 @@
../../../local/patches/base/P53-e1000d-itr-coalescing.patch
@@ -1 +0,0 @@
../../../local/patches/base/P54-acpid-thermal-module.patch
@@ -1 +0,0 @@
../../../local/patches/base/P55-logd-json-format.patch
@@ -1 +0,0 @@
../../../local/patches/base/P58-logd-requires-randd.patch
@@ -1 +0,0 @@
../../../local/patches/base/P6-driver-main-fixes.patch
@@ -1 +0,0 @@
../../../local/patches/base/P6-driver-new-modules.patch
+1 -8
View File
@@ -1,12 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/base.git"
rev = "463f76b9608a896e6f6c9f63457f57f6409873c7"
patches = [
"redox.patch",
"P10-rootfs-uuid-search-no-block.patch",
"P11-init-noise-reduction.patch",
"P12-init-fix-init-debug-import.patch",
]
path = "../../../local/sources/base"
[package]
installs = [
@@ -1 +0,0 @@
../../../local/patches/bootloader/P2-live-preload-guard.patch
@@ -1 +0,0 @@
../../../local/patches/bootloader/absorbed/P3-uefi-live-image-safe-read.patch
@@ -1 +0,0 @@
../../../local/patches/bootloader/absorbed/P4-live-large-iso-boot.patch
@@ -1 +0,0 @@
../../../local/patches/bootloader/P5-live-preload-cap-1gib.patch
@@ -1 +0,0 @@
../../../local/patches/bootloader/fix-uefi-alloc-panic.patch
+1 -2
View File
@@ -1,6 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/bootloader.git"
patches = ["redox.patch", "fix-uefi-alloc-panic.patch", "P0-gpt-partition-offset.patch", "P5-live-preload-cap-128mib.patch", "P6-full-ramdisk-preload.patch", "P7-redbear-branding.patch"]
path = "../../../local/sources/bootloader"
[build]
template = "custom"
-1
View File
@@ -1 +0,0 @@
../../../local/patches/bootloader/redox.patch
+1 -2
View File
@@ -1,6 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/installer.git"
patches = ["redox.patch"]
path = "../../../local/sources/installer"
[build]
template = "cargo"
-1
View File
@@ -1 +0,0 @@
../../../local/patches/installer/redox.patch
-1
View File
@@ -1 +0,0 @@
../../../local/patches/kernel/P0-canary.patch
@@ -1 +0,0 @@
../../../local/patches/kernel/P1-memory-map-overflow.patch
-1
View File
@@ -1,6 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/kernel.git"
patches = ["redox.patch", "P0-canary.patch", "P1-memory-map-overflow.patch", "../../../local/patches/kernel/P4-supplementary-groups.patch"]
[build]
template = "custom"
+1 -53
View File
@@ -1,57 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/kernel.git"
rev = "866dfad0"
patches = [
"../../../local/patches/kernel/redbear-consolidated.patch",
"../../../local/patches/kernel/P8-msi.patch",
"../../../local/patches/kernel/P8-msi-foundation-v2.patch",
"../../../local/patches/kernel/P2-rebrand-start-message.patch",
"../../../local/patches/kernel/P0-eventfd-kernel.patch",
"../../../local/patches/kernel/P0-rsdp-checksum.patch",
"../../../local/patches/kernel/P1-mkfifo-fifo-support-v2.patch",
"../../../local/patches/kernel/P1-ioapic-hpet-nmi-v2.patch",
"../../../local/patches/kernel/P9-numa-topology.patch",
"../../../local/patches/kernel/P9-proc-lock-ordering.patch",
"../../../local/patches/kernel/P9-percpu-context-switch.patch",
"../../../local/patches/kernel/P9-broadcast-tlb-shootdown.patch",
"../../../local/patches/kernel/P9-ioapic-irq-affinity.patch",
"../../../local/patches/kernel/P10-irq-affinity-wiring.patch",
"../../../local/patches/kernel/P11-mcs-lock.patch",
"../../../local/patches/kernel/P12-range-tlb-flush.patch",
"../../../local/patches/kernel/P13-priority-inheritance.patch",
"../../../local/patches/kernel/P14-numa-topology.patch",
"../../../local/patches/kernel/P15-1-ap-cpu-id-race.patch",
"../../../local/patches/kernel/P15-4-mcs-pi-ordering.patch",
"../../../local/patches/kernel/P15-10-tlb-range-ordering.patch",
"../../../local/patches/kernel/P16-3-max-cpu-256.patch",
"../../../local/patches/kernel/P16-1-sipi-timing.patch",
"../../../local/patches/kernel/P16-4a-sdt-checksum.patch",
"../../../local/patches/kernel/P16-4b-madt-validation.patch",
"../../../local/patches/kernel/P17-2a-percpu-waiting.patch",
"../../../local/patches/kernel/P17-2b-transitive-pi.patch",
"../../../local/patches/kernel/P17-4-configurable-preempt.patch",
"../../../local/patches/kernel/P17-1-numa-selection.patch",
"../../../local/patches/kernel/P17-3-sched-affinity.patch",
"../../../local/patches/kernel/P17-3-syscall-dispatch.patch",
"../../../local/patches/kernel/P19-2-irq-debug.patch",
# P20: x2APIC ICR mode fix (32-bit dest field for x2APIC, 8-bit for xAPIC)
"../../../local/patches/kernel/P20-x2apic-icr-mode-fix.patch",
# P21: x2APIC SMP bring-up fix — skip 8-bit LocalApic entries when x2APIC
# is active (BSP ID mismatch causes all APs to be skipped on bare metal Intel)
"../../../local/patches/kernel/P21-x2apic-smp-fix.patch",
# P22: x2APIC MADT fallback — when x2APIC is active but MADT has no
# LocalX2Apic entries (QEMU, some BIOS), fall back to processing LocalApic
# entries with zero-extended IDs using x2APIC 64-bit ICR format
"../../../local/patches/kernel/P22-x2apic-madt-fallback.patch",
# P23: sys:msr scheme — kernel MSR read/write via /scheme/sys/msr/<cpu>/<msr>
"../../../local/patches/kernel/P23-sys-msr-scheme.patch",
# P25: Comprehensive cpuidle framework with deep C-states (C1-C7)
"../../../local/patches/kernel/P25-cpuidle-deep-cstates.patch",
# P26: DebugDisplay proper scrolling — ptr::copy rows up instead of wrapping to top
"../../../local/patches/kernel/P26-debug-display-scroll.patch",
# P27: Capability bitmask — replace uid==0 checks with has_cap() capability model
"../../../local/patches/kernel/P27-capability-bitmask.patch",
]
path = "../../../local/sources/kernel"
[build]
template = "custom"
@@ -1 +0,0 @@
../../../local/patches/kernel/redbear-consolidated.patch
-1
View File
@@ -1 +0,0 @@
../../../local/patches/kernel/redox.patch
+1 -2
View File
@@ -1,6 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/redoxfs.git"
patches = ["P2-readonly-live-media-open.patch", "P3-uuid-retry.patch"]
path = "../../../local/sources/redoxfs"
[build]
template = "custom"
@@ -1 +0,0 @@
../../../local/patches/relibc/P10-stack-size-8mb.patch
@@ -1 +0,0 @@
../../../local/patches/relibc/P11-getrlimit-getrusage.patch
@@ -1 +0,0 @@
../../../local/patches/relibc/P3-bits-eventfd-mod.patch
@@ -1 +0,0 @@
../../../local/patches/relibc/P3-bits-eventfd.patch
@@ -1 +0,0 @@
../../../local/patches/relibc/P3-eventfd-cbindgen.patch
@@ -1 +0,0 @@
../../../local/patches/relibc/P3-eventfd-impl.patch
@@ -1 +0,0 @@
../../../local/patches/relibc/P3-sys-types-stdint-include.patch
+1 -101
View File
@@ -1,105 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/relibc.git"
rev = "861bbb0"
patches = [
"P3-eventfd-mod.patch",
# Add pub mod bits_eventfd to header/mod.rs
"P3-bits-eventfd-mod.patch",
# bits_eventfd module (eventfd_t type)
"P3-bits-eventfd.patch",
# sys_eventfd module — FULL eventfd() implementation (opens /scheme/event/eventfd)
"P3-eventfd-impl.patch",
# cbindgen.toml for sys/eventfd.h C header generation
"P3-eventfd-cbindgen.patch",
# eventfd_read() and eventfd_write() helpers
"P3-eventfd-readwrite.patch",
# sys_signalfd module (cbindgen.toml + mod.rs with cbindgen exports)
"P3-signalfd-header.patch",
# signalfd implementation (signal/signalfd.rs + signal/mod.rs wiring)
"P3-signalfd.patch",
# sys_timerfd module (creates mod.rs with timerfd_create/settime/gettime)
"P3-timerfd-impl.patch",
# timerfd: creates cbindgen.toml, reformats, adds relative time handling
"P3-timerfd-relative.patch",
# timerfd: fix cbindgen.toml to generate C (not C++) headers
"P3-timerfd-cbindgen-fix.patch",
# REMOVED: P3-sys-types-stdint-include.patch — upstream already has
# sys_includes = ["stddef.h"] (no stdint.h). Adding stdint.h here creates
# a circular include chain with gnulib:
# gnulib stdint.h → inttypes.h → wchar.h → stdio.h → sys/types.h →
# sys/types/internal.h → stdint.h → cycle
# Headers needing stdint.h include it directly (signal.h, signalfd.h, eventfd.h).
# open_memstream: single-patch implementation in stdio/mod.rs
"P3-open-memstream.patch",
# F_DUPFD_CLOEXEC fallback (try CLOEXEC, fall back to DUPFD + SETFD)
"P3-fcntl-dupfd-cloexec.patch",
# Non-conflicting individual patches
"P3-elf64-types.patch",
"P3-clock-nanosleep.patch",
"P3-exec-root-bypass.patch",
"P3-secure-getenv.patch",
"P3-getentropy.patch",
"P3-dup3.patch",
"P3-waitid-header.patch",
"P3-waitid.patch",
"P3-in6-pktinfo.patch",
"P3-inet6-pton-ntop.patch",
"P3-tcp-nodelay.patch",
"P3-tcp-sockopt-forward.patch",
# Named POSIX semaphores (sem_open/close/unlink) — comprehensive + refcount + va_list
"P3-semaphore-comprehensive.patch",
# semaphore.h: expose SEM_FAILED and real variadic sem_open() prototype/ABI
"P3-semaphore-varargs-header.patch",
# Reverse From<&syscall::TimeSpec> for timespec (needed by getrusage)
"P3-timespec-reverse-from.patch",
"P10-stack-size-8mb.patch",
"P11-getrlimit-getrusage.patch",
# Move #include <stdint.h> after size_t/ptrdiff_t typedefs in stddef.h
# to prevent recursive include chain (stdint.h → sys/types.h → pthread.h)
# from seeing undefined size_t when gnulib wrappers are present
"P3-stddef-reorder.patch",
# ld.so: parse DT_RPATH in addition to DT_RUNPATH (RUNPATH takes precedence per gABI)
"P3-ldso-rpath-support.patch",
# signal.h cbindgen: expose stdint types to downstream consumers
"P3-signal-stdint-include.patch",
# spawn.h implementation (new header module)
"P3-spawn.patch",
# spawn: wire pub mod spawn into header/mod.rs
"P3-spawn-module-wire.patch",
# spawn: posix_spawnattr_setflags, posix_spawnattr_setsigmask + getters
"P3-spawn-setflags-setsigmask.patch",
# C11 threads.h compatibility header
"P3-threads.patch",
# stdio_ext: __freadahead, __fpending, __fseterr helpers
"P3-stdio-fseterr.patch",
# locale: getlocalename_l function
"P3-locale-getlocalename-l.patch",
# SysV IPC foundation (key_t, ipc_perm, IPC_* constants, sys/ipc.h header)
"P3-sysv-ipc.patch",
# SysV semaphore implementation (semget/semop/semctl)
"P3-sysv-sem-impl.patch",
# SysV shared memory implementation (shmget/shmat/shmdt/shmctl)
"P3-sysv-shm-impl.patch",
# IPC tests (semaphore/shm)
"P3-ipc-tests.patch",
# ST_RDONLY/ST_NOSUID constants for statvfs (POSIX)
"P3-statvfs-constants.patch",
"P3-ld-so-usr-lib-search-path.patch",
# Remove relibc's DRM ioctl handler — libdrm's redox_drm_simple_ioctl()
# handles all DRM ioctls with its own scheme:drm wire format.
"P5-remove-drm-ioctl-intercept.patch",
# Break gnulib circular include chain: inttypes.h → wchar.h conditional guard
"P3-inttypes-wchar-guard.patch",
# Break gnulib circular include chain: wchar.h forward-declare FILE/tm instead
# of including stdio.h/time.h
"P3-wchar-forward-decls.patch",
# stdlib: getloadavg() — returns -1 (load average not available on Redox)
"P3-getloadavg.patch",
]
path = "../../../local/sources/relibc"
[build]
template = "custom"
-1
View File
@@ -1 +0,0 @@
../../../local/patches/relibc/absorbed/redox.patch
@@ -1 +0,0 @@
../../../local/patches/base/P4-login-rate-limit.patch
+1 -2
View File
@@ -1,6 +1,5 @@
[source]
git = "https://gitlab.redox-os.org/redox-os/userutils.git"
patches = ["P5-redbear-branding.patch", "P6-login-privilege-drop.patch", "P7-login-diagnostics.patch", "P8-login-proc-fd.patch"]
path = "../../../local/sources/userutils"
[build]
template = "custom"
-3
View File
@@ -4,9 +4,6 @@
[source]
git = "https://github.com/uutils/coreutils"
rev = "1f7c81f5d2d3e56c518349c0392158871a1ea9ec"
patches = [
"redox.patch"
]
[build]
template = "custom"
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz"
blake3 = "5c95d48f5b9150f4a06d8acac12c25edaac956007df95a3bf527df02a5908f0e"
patches = [
"redox.patch"
]
[build]
template = "meson"
dependencies = [
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://www.kernel.org/pub/software/scm/git/git-2.13.1.tar.xz"
blake3 = "bc78271bffd60c5b8b938d8c08fd74dc2de8d21fbaf8f8e0e3155436d9263f17"
patches = ["git.patch"]
[build]
dependencies=[
-1
View File
@@ -1,7 +1,6 @@
[source]
git = "https://luajit.org/git/luajit.git"
rev = "a4f56a459a588ae768801074b46ba0adcfb49eb1"
patches = ["redox.patch"]
[build]
template = "custom"
script = """
-5
View File
@@ -1,11 +1,6 @@
[source]
tar = "https://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.xz"
blake3 = "d46d14c12aa4ea51e356bf92091c368fd871e1d770b94bc29027886737aecd5f"
patches = [
"01_no_rlimit.patch",
"02_no_chown.patch",
"03_renameat2.patch",
]
script = """
wget -O build-aux/config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false"
autoreconf
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://www.php.net/distributions/php-8.4.17.tar.xz"
blake3 = "a8478dddd948d4b26e51c5727ac0895440da76e8ad9be947098a4284ca0b7f2a"
patches = [
"redox.patch"
]
[build]
template = "custom"
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://www.python.org/ftp/python/3.12.12/Python-3.12.12.tar.xz"
blake3 = "29636fdae3e0ee8d0fe585e528c9376fe43876f5f3f0f7892140567946fd907b"
patches = [
"redox.patch"
]
[build]
template = "custom"
-3
View File
@@ -3,9 +3,6 @@ git = "https://github.com/RustPython/RustPython"
# newer rev requires 'bits/libc-header-start.h' for bindgen
rev = "2025-10-13-main-51"
shallow_clone = true
patches = [
"redox.patch"
]
[build]
dependencies = [
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://sourceforge.net/projects/dosbox/files/dosbox/0.74-3/dosbox-0.74-3.tar.gz/download"
blake3 = "8bc50ffdba20579fb3080a0dca32cb939c8a3c19259aed026482c6ac069b0007"
patches = ["01_redox.patch"]
script = """
./autogen.sh
GNU_CONFIG_GET config.sub
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://mednafen.github.io/releases/files/mednafen-1.29.0.tar.xz"
blake3 = "c75c1044cdc9328b2349915a67972d6135c77eb53eb0d995788f22b7daacf79b"
patches = [
"redox.patch",
]
[build]
template = "custom"
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://github.com/mgba-emu/mgba/archive/0.10.5.tar.gz"
blake3 = "a1b9e797a5058f5264d276805aef5643b7ea460916e491a0098ba32d87f1519e"
patches = ["redox.patch"]
[build]
dependencies = ["libiconv", "liborbital", "libpng", "pixman", "sdl1", "zlib"]
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://downloads.scummvm.org/frs/scummvm/2.0.0/scummvm-2.0.0.tar.xz"
blake3 = "02e6791fd43ad3cb4238c07d23350ca1459a0f692689e585dba1d46648f64327"
patches = ["redox.patch"]
script = """
GNU_CONFIG_GET config.sub
"""
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://dukeworld.com/eduke32/synthesis/20181010-7067/eduke32_src_20181010-7067.tar.xz"
blake3 = "b0b759fe9ca51849f42669e4832ae1ae1f9ad7938529769108f7cf6a6a176558"
patches = ["redox.patch"]
[build]
dependencies = [
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://neverball.org/neverball-1.6.0.tar.gz"
blake3 = "74f3b68595f475e89fd2ca8b5fc349837ff36fbbe141f321dfc232dbf8fccf51"
patches = ["redox.patch"]
[build]
dependencies = [
-1
View File
@@ -3,7 +3,6 @@ git = "https://github.com/OpenTTD/OpenTTD.git"
#TODO: fix issues with this: branch = "release/1.8"
rev = "231402fb4bea0a0d6a16cef90764d9e7aa699c53"
shallow_clone = true
patches = ["redox.patch"]
[build]
template = "custom"
-1
View File
@@ -9,7 +9,6 @@
[source]
git = "https://github.com/opentyrian/opentyrian"
patches = [ "redox.patch" ]
[build]
template = "custom"
-1
View File
@@ -1 +0,0 @@
../../../local/patches/orbutils/redox.patch
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://www.cairographics.org/releases/cairo-1.18.4.tar.xz"
blake3 = "b9fa14e02f85ec4e72396c62236c98502d04dbbdf8daf01ab9557a1c7aa7106e"
patches = ["redox.patch"]
[build]
dependencies = [
-4
View File
@@ -1,10 +1,6 @@
[source]
tar = "https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz"
blake3 = "4879074c357102f85932673044c57c144b0c188ae58edec2a115965536ee340f"
patches = [
"ffmpeg.patch",
"binutils-2.41.patch",
]
[build]
template = "custom"
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://download.gnome.org/sources/glib/2.87/glib-2.87.0.tar.xz"
blake3 = "26b77ae24bc02f85d1c6742fe601167b056085f117cda70da7b805cefa6195e9"
patches = [
"redox.patch",
]
[build]
template = "custom"
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/1.24.12/gstreamer-1.24.12.tar.gz"
blake3 = "181daf73050f7472ec656e7461b7f67028d6002c1133870576033a32e43a364f"
patches = ["redox.patch"]
[build]
template = "custom"
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://libarchive.org/downloads/libarchive-3.6.2.tar.xz"
blake3 = "f98695fe81235a74fa3fc2c3ba0f0d4f13ea15f9be3850b83e304cf5d78be710"
patches = [
"redox.patch"
]
[build]
template = "configure"
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz"
blake3 = "820b3b9fd3e2181bfb95475f01e9a3451e6d751e4f8c98ebcdcca1d8aa720f7f"
patches = [
"01_redox.patch"
]
script = """
DYNAMIC_INIT
cp /usr/share/aclocal/libtool.m4 ./m4/
-1
View File
@@ -1,6 +1,5 @@
[source]
tar = "https://lttng.org/files/urcu/userspace-rcu-0.14.0.tar.bz2"
patches = ["0001-Fix-compilation-on-Redox-OS.patch"]
[build]
template = "configure"
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://dist.libuv.org/dist/v1.51.0/libuv-v1.51.0.tar.gz"
blake3 = "e8b5e68bc2d0776ac4ea67df59d694fca58d5cc570c103443a2284e723d01fc2"
patches = ["redox.patch"]
[build]
template = "custom"
-1
View File
@@ -3,7 +3,6 @@ git = "https://gitlab.redox-os.org/redox-os/mesa.git"
upstream = "https://gitlab.freedesktop.org/mesa/mesa"
branch = "redox-24.0"
shallow_clone = true
patches = ["../../../local/patches/mesa/P4-virgl-redox-disk-cache.patch", "../../../local/patches/mesa/P5-gbm-dumb-prime-export.patch", "../../../local/patches/mesa/P6-platform-redox-gpu-probe.patch"]
[build]
template = "custom"
dependencies = [
-3
View File
@@ -1,9 +1,6 @@
[source]
tar = "https://ftp.gnu.org/gnu/ncurses/ncurses-6.6.tar.gz"
blake3 = "fbec55697a01f99b9cc3f25be55e73ae7091f4c53e5d81a1ea15734c4e5b7238"
patches = [
"redox.patch"
]
[build]
template = "custom"
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://download.gnome.org/sources/pango/1.56/pango-1.56.3.tar.xz"
blake3 = "78542feaaf007c1d648b94c4e9b6655ed7515d27ce434766aea99bef886c21ac"
patches = ["redox.patch"]
[build]
dependencies = [
-3
View File
@@ -4,9 +4,6 @@ blake3 = "12d515ba12a816994def6b1e7196b5783fd2cfe495733a9167fa4d71dbe10248"
script = """
autotools_recursive_regenerate
"""
patches = [
"redox.patch"
]
[build]
template = "custom"
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://www.cairographics.org/releases/pixman-0.46.0.tar.xz"
blake3 = "379369245a0bbd13784bf550c87622964a6aba87edf598ffa137dc10201746e0"
patches = ["redox.patch"]
[build]
template = "custom"
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://sourceforge.net/projects/sdlgfx/files/SDL_gfx-2.0.25.tar.gz"
blake3 = "e6f571a38e51d369b010f4b10eb35b95e3d2edae2edd796241c47ea8376581e6"
patches = ["redox.patch"]
script = """
./autogen.sh
"""
-1
View File
@@ -1,7 +1,6 @@
[source]
tar = "https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.tar.gz"
blake3 = "731a6f8cad9fff22c82394bd1c0c34ce4aa60fa8923f3755a3e3239f1e269389"
patches = ["redox.patch"]
script = """
./autogen.sh
"""

Some files were not shown because too many files have changed in this diff Show More