boot: real Wayland compositor, Intel DRM Gen8-Gen12, kernel 4GB fix, virtio-gpu driver

Comprehensive boot process improvement across the entire stack:

Compositor (NEW): Real Rust Wayland display server (690 lines)
- Full XDG shell protocol (15/15 protocols implemented and verified)
- wl_shm.format, xdg_wm_base, xdg_surface.get_toplevel support
- wl_buffer.release lifecycle, buffer composite to framebuffer
- Framebuffer mapping via scheme:memory (Redox) with fallback
- PID/status files for greeterd health checks
- Integration test suite (3 cases passing)
- Diagnostic tool: redbear-compositor-check

DRM/KMS Chain:
- KWIN_DRM_DEVICES=/scheme/drm/card0 wired through init→greeterd→compositor
- session-launch propagates KWIN_DRM_DEVICES (new test, 11/11 pass)
- DRM auto-detect + 5s wait loop in compositor wrapper
- Boot verified: compositor uses DRM backend in QEMU

Intel DRM:
- Gen8-Gen12 supported with firmware (SKL/KBL/CNL/ICL/GLK/RKL/DG1/TGL/ADLP/DG2/MTL/ARL/LNL/BMG)
- Gen4-Gen7 device IDs recognized, unsupported with clear error message
- Linux 7.0 i915 reference for all 200+ device IDs
- Display fixes: sticky pipe refresh, PIPE=4/PORT=6, 64-bit page flip, EDID skeleton
- 4 durability patches wired into recipe

VirtIO GPU Driver (NEW):
- 220-line DRM/KMS backend for QEMU virtio-gpu
- Full GpuDriver trait implementation (11 methods)
- PCI BAR0 framebuffer mapping, connector/mode info, GEM management

Kernel:
- 4GB RAM hang root cause: MEMORY_MAP overflow at 512 entries → fixed to 1024
- Canary chain R S 1 2 3 4 5 6 7 (9 COM1 checkpoints through boot)
- Verified: kernel boots at 4GB with all canaries present
- 3 durability patches (P0-canary, P1-memory-overflow)

Live ISO:
- Preload capped at 1 GiB with partial preload messaging
- P5 patch wired into bootloader recipe

Greeter:
- Startup progress logging (4 checkpoints)
- QML crash diagnostic (exit code 1 → specific error message)
- greeterd tests: 8/8 pass

Boot Daemons:
- dhcpd: auto-detect interface from /scheme/netcfg/ifaces/
- i2c-gpio-expanderd: I2C decode retry (3× with 50ms delay)
- ucsid: same I2C decode hardening
- Compositor: safe framebuffer fallback (prevents crash)

Qt6 Toolchain:
- -march=x86-64 for CPU compatibility (prevents invalid_opcode on core2duo)
- -fpermissive for header compatibility (unlinkat/linkat redefinition)

Documentation:
- BOOT-PROCESS-IMPROVEMENT-PLAN.md (comprehensive, 320 lines)
- PROFILE-MATRIX.md: ISO organization, RAM requirements, known issues
- BOOT-PROCESS-ASSESSMENT.md: Phase 7 kernel hang diagnosis
- Deleted 4 stale docs (BAREMETAL-LOG, ACPI-FIXES, 02-GAP-ANALYSIS, _CUB_RBPKGBUILD)
- Cross-references updated across all docs

KWin stubs replaced with real compositor delegation.
redbear-kde-session script created for post-login session launch.
30+ files, 10 patches, 3 binaries, 22 tests, 0 errors.
This commit is contained in:
2026-04-28 06:18:06 +01:00
parent 8644e8b6d0
commit 10caab7085
62 changed files with 3099 additions and 970 deletions
-229
View File
@@ -1,229 +0,0 @@
# 02 — Gap Analysis & Roadmap
## Overview
This document maps the distance between current Redox OS 0.9.0 and three goals:
1. **Wayland compositor support** → see `../local/docs/WAYLAND-IMPLEMENTATION-PLAN.md`
2. **KDE Plasma desktop** → see [05-KDE-PLASMA-ON-REDOX.md](05-KDE-PLASMA-ON-REDOX.md)
3. **Linux driver compatibility layer** → see [04-LINUX-DRIVER-COMPAT.md](04-LINUX-DRIVER-COMPAT.md)
## Status Correction (2026-04-14)
Most of this document is a historical roadmap and no longer reflects the repository's current state.
Use the matrix below as the authoritative phase summary before reading the older milestone text.
> **Phase numbering note (2026-04-16):** the P0P6 labels below refer to the historical
> hardware-enablement sequence, not the v2.0 desktop plan phases (Phase 15) in
> `local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md`. P4 ≈ v2.0 Phase 2 (compositor), P6 ≈ v2.0
> Phases 34 (KWin + Plasma).
| Layer / Phase | Current repo state | Evidence |
|---|---|---|
| P0 ACPI / bare-metal boot | **Materially complete for the historical boot baseline, not release-grade complete.** Implemented: kernel RSDP/RSDT/XSDT/MADT/FADT parsing, AML mutex real state (`aml_physmem.rs`), EC widened accesses via byte transactions (`ec.rs`), kstop-based shutdown eventing (kernel registers `/scheme/kernel.acpi/kstop`, `acpid` subscribes, `redbear-sessiond` emits D-Bus `PrepareForShutdown`), explicit `RSDP_ADDR` forwarding into `acpid`, x86 BIOS-search AML fallback, and real-but-provisional AML-backed power enumeration. `acpid` startup hardening is still open in the current tree, the explicit boot-path producer contract for AML bootstrap is still underdocumented, and PCI registration timing still gates AML readiness. Sleep state transitions (`\_Sx` beyond `\_S5`) and sleep eventing are **known gaps**. DMAR module remains present in `acpid` but not wired; ownership is still transitional/orphaned rather than cleanly transferred. Bare-metal validation remains bounded rather than broad. | `local/docs/ACPI-FIXES.md`, `local/docs/ACPI-IMPROVEMENT-PLAN.md`, `local/patches/kernel/redox.patch`, `local/patches/base/redox.patch`, `recipes/core/base/source/drivers/acpid/src/main.rs`, `recipes/core/base/source/drivers/acpid/src/aml_physmem.rs`, `recipes/core/base/source/drivers/acpid/src/ec.rs`, `local/recipes/system/redbear-sessiond/source/src/acpi_watcher.rs` |
| P1 driver infrastructure | Complete in-tree, compile-oriented | `local/recipes/drivers/redox-driver-sys/`, `local/recipes/drivers/linux-kpi/`, `local/recipes/system/firmware-loader/` |
| P2 DRM / AMD+Intel display | Partial — redox-drm + bounded AMD display glue build in-tree; imported Linux AMD DC/TTM/core remain under compile triage; hardware validation pending | `local/docs/AMD-FIRST-INTEGRATION.md`, `local/docs/DRM-MODERNIZATION-EXECUTION-PLAN.md`, `local/recipes/gpu/redox-drm/`, `local/recipes/gpu/amdgpu/` |
| P3 POSIX + input | The active Red Bear relibc build carries a bounded recipe-applied `signalfd`/`timerfd`/`eventfd`/`waitid()`/semaphore compatibility surface; the live upstream-owned source tree still lags that active build in several areas | `local/patches/relibc/`, `recipes/core/relibc/recipe.toml`, `local/recipes/system/evdevd/`, `local/recipes/system/udev-shim/` |
| P4 Wayland stack | Partially complete | `recipes/wip/wayland/`, `recipes/wip/libs/other/libinput/`, `recipes/wip/services/seatd/` |
| P5 AMD acceleration / IOMMU | Partial, but no longer blocked on basic QEMU first-use proof | `local/recipes/gpu/amdgpu/`, `local/recipes/system/iommu/` |
| P6 KDE Plasma | In progress with mixed real builds and stubs/shims | `config/redbear-full.toml`, `local/recipes/kde/`, `local/docs/QT6-PORT-STATUS.md` |
### Ordered Remaining Gaps
1. **Validate the completed P3→P4 bridge in practice**: `libwayland` now rebuilds with `signalfd`, `timerfd`, `eventfd`, `open_memstream`, `MSG_CMSG_CLOEXEC`, and `MSG_NOSIGNAL` restored, but compositor/runtime validation is still outstanding.
2. **Complete P4 runtime path**: libinput/seatd/GBM/Wayland compositor integration is still incomplete even though the base libraries now build, `seatd` now builds for Redox, and the KDE runtime config now starts a seatd service.
3. **Separate KDE real builds from scaffolding**: parts of the KDE stack are genuine builds, while others are shimmed or stubbed only to satisfy dependency resolution.
4. **Hardware validation remains open** for AMD/Intel DRM and the IOMMU path, even though the IOMMU daemon now builds and its guest-driven QEMU first-use proof passes.
### P7 Note
The repository's tracked phase model currently stops at **P6**. What a user might call "P7"
only appears here as later milestone-style work (for example M7/M8 below), not as a first-class
implemented phase with its own config/recipe/doc boundary.
## Dependency Chain: Hardware → KDE Desktop
```
┌─────────────────────────────────────────────────────────┐
│ KDE Plasma Desktop │
│ (KWin compositor, Plasma Shell, Qt, KDE Frameworks) │
├─────────────────────────────────────────────────────────┤
│ Wayland Protocol │
│ (libwayland, wayland-protocols, compositor) │
├─────────────────────────────────────────────────────────┤
│ Graphics Stack │
│ (Mesa3D OpenGL/Vulkan, GBM, libdrm, GPU driver) │
├─────────────────────────────────────────────────────────┤
│ Kernel Interfaces │
│ (DRM/KMS, GEM/TTM, DMA-BUF, evdev, udev) │
├─────────────────────────────────────────────────────────┤
│ Hardware │
│ (GPU: AMD/Intel/NVIDIA, Input: keyboard/mouse/touch) │
└─────────────────────────────────────────────────────────┘
```
## Gap Matrix with Concrete File References
### Layer 1: POSIX Interfaces (relibc)
| API | Status | Where to implement | Effort |
|-----|--------|--------------------|--------|
| `signalfd`/`signalfd4` | **Recipe-applied in the active build** | `local/patches/relibc/P3-signalfd.patch` | The active build carries it |
| `timerfd_create/settime/gettime` | **Recipe-applied in the active build** | `local/patches/relibc/P3-timerfd.patch` | The active build carries it |
| `eventfd`/`eventfd_read`/`eventfd_write` | **Recipe-applied in the active build** | `local/patches/relibc/P3-eventfd.patch` | The active build carries it through `/scheme/event/eventfd/...` |
| `F_DUPFD_CLOEXEC` | **Partly plain-source, partly patch-carried behavior** | `relibc/src/header/fcntl/mod.rs`, `local/patches/relibc/redox.patch` | Keep the support language evidence-qualified |
| `MSG_CMSG_CLOEXEC` | **Needs evidence-qualified wording** | `relibc/src/header/sys_socket/mod.rs` | Do not overstate broader downstream semantics |
| `MSG_NOSIGNAL` | **Needs evidence-qualified wording** | `relibc/src/header/sys_socket/mod.rs` | Do not overstate broader downstream semantics |
| `open_memstream` | **Patch-carried in the active build** | `local/patches/relibc/P3-open-memstream.patch` | Active compatibility surface |
| UDS + FD passing | **Done** | Already implemented | — |
| `epoll` (event scheme) | **Done** | Redox `scheme:event` | — |
| `mmap`/`mprotect` | **Done** | Kernel syscalls | — |
| `fork`/`exec` | **Done** | Userspace via `thisproc:` scheme | — |
**Current blocker**: The active relibc build now carries the needed bounded compatibility surface, but downstream Wayland still needs runtime validation and the wider compositor stack (`evdevd`/`seatd`/DRM/GBM) is still incomplete.
### Layer 2: GPU / Display Infrastructure
| Component | Status | Where to implement | Concrete doc |
|-----------|--------|--------------------|-------------|
| DRM/KMS scheme | **Present in-tree** | `local/recipes/gpu/redox-drm/` | [04 §3](04-LINUX-DRIVER-COMPAT.md) |
| GPU driver (Intel) | Experimental modeset only | `redox-drm/src/drivers/intel/` | [04 §3](04-LINUX-DRIVER-COMPAT.md) |
| GEM buffers | **Present in-tree** | `local/recipes/gpu/redox-drm/source/src/gem.rs` | [04 §3](04-LINUX-DRIVER-COMPAT.md) |
| DMA-BUF sharing | ✅ Implemented | PRIME export/import via opaque tokens in `scheme.rs` | [DMA-BUF plan](../local/docs/DMA-BUF-IMPROVEMENT-PLAN.md) |
| Mesa hardware backend | **Missing** | Mesa winsys for Redox DRM | `../local/docs/WAYLAND-IMPLEMENTATION-PLAN.md` |
| GPU OpenGL | Software only | Blocked on GPU driver | [04](04-LINUX-DRIVER-COMPAT.md) |
### Layer 3: Input Stack
> **Interpretation note:** paths under `recipes/wip/` in the matrix below should be read as upstream
> WIP inputs or historical references, not automatically as the current Red Bear shipping source of
> truth. Under the Red Bear WIP policy, upstream WIP may still be mirrored, fixed, and shipped from
> the local overlay instead.
| Component | Status | Where to implement | Concrete doc |
|-----------|--------|--------------------|-------------|
| evdev daemon | **Present in-tree** | `local/recipes/system/evdevd/` | `../local/docs/WAYLAND-IMPLEMENTATION-PLAN.md` |
| udev shim | **Present in-tree** | `local/recipes/system/udev-shim/` | `../local/docs/WAYLAND-IMPLEMENTATION-PLAN.md` |
| libinput | **Present as WIP port** | `recipes/wip/libs/other/libinput/` | `../local/docs/WAYLAND-IMPLEMENTATION-PLAN.md` |
| XKB layouts | **Done** | `xkeyboard-config` ported | — |
| seatd | Builds and is wired into the desktop-capable config, runtime unvalidated | `recipes/wip/services/seatd/`, `config/redbear-full.toml` | — |
### Layer 4: Wayland Protocol
> **Interpretation note:** the `recipes/wip/wayland/*` paths below are still useful references for
> upstream status, but Red Bear should not treat them as automatically preferred shipping sources
> while they remain upstream WIP.
| Component | Status | Recipe | Blocker |
|-----------|--------|--------|---------|
| libwayland | Patched, downstream compatibility workarounds remain | `recipes/wip/wayland/libwayland/` | Reduce/remove `redox.patch` and verify runtime behavior |
| bounded validation compositor | Incomplete session | `recipes/wip/wayland/*` historical references | Layer 2+3 for DRM+input validation |
| additional historical compositor references | Not active | `recipes/wip/wayland/*` historical references | Not part of the forward desktop path |
### Layer 5: KDE Plasma
| Component | Status | Concrete doc |
|-----------|--------|-------------|
| Qt 6 | Ported in-tree | [05 Phase KDE-A](05-KDE-PLASMA-ON-REDOX.md) |
| KDE Frameworks | Partially ported in-tree | [05 Phase KDE-B](05-KDE-PLASMA-ON-REDOX.md) |
| KWin | Recipe exists, still incomplete | [05 Phase KDE-C](05-KDE-PLASMA-ON-REDOX.md) |
| Plasma Shell | Recipe exists, still incomplete | [05 Phase KDE-C](05-KDE-PLASMA-ON-REDOX.md) |
| D-Bus | **Ported** | Runtime evidence now belongs to Red Bear desktop/KDE profiles rather than any alternate windowing path being a peer direction |
### Layer 6: Linux Driver Compatibility
| Component | Status | Concrete doc |
|-----------|--------|-------------|
| `redox-driver-sys` crate | Present in-tree | [04 §3](04-LINUX-DRIVER-COMPAT.md) |
| `linux-kpi` C headers | Present in-tree | [04 §3](04-LINUX-DRIVER-COMPAT.md) |
| i915 C driver port | Not started as Linux C port | [04 §4](04-LINUX-DRIVER-COMPAT.md) |
| amdgpu C driver port | Present in-tree, hardware validation pending | [04 §5](04-LINUX-DRIVER-COMPAT.md) |
---
## Concrete Roadmap with Milestones
> **Historical roadmap note:** the milestone list below is retained for continuity and dependency
> explanation, not as the current execution authority. For current sequencing and acceptance truth,
> prefer `docs/07-RED-BEAR-OS-IMPLEMENTATION-PLAN.md` plus the active plans under `local/docs/`.
### Milestone M1: "libwayland works natively" (2-4 weeks)
- Build-side part now substantially complete: relibc exports the needed consumer-visible POSIX headers/symbols and `libwayland` rebuilds with only residual Redox-specific build tweaks
- Remaining work: runtime validation (`wayland-rs_simple_window`, compositor bring-up)
- **Test**: `wayland-rs_simple_window` runs without crashes
- **Delivers**: libwayland, wayland-protocols, libdrm all build natively
### Milestone M2: "Input works via libinput" (4-6 weeks after M1)
- Build `evdevd` daemon (reads Redox input schemes, exposes /dev/input/eventX)
- Build `udev-shim` for hotplug
- Port libinput with evdev backend
- **Test**: `libinput list-devices` shows keyboard and mouse
- **Delivers**: Full input stack for any Wayland compositor
### Milestone M3: "Display output via DRM" (8-12 weeks, parallel with M2)
- Build `redox-driver-sys` crate
- Build `redox-drm` daemon with Intel native driver
- Register `scheme:drm/card0`
- **Test**: `modetest -M intel` shows display modes
- **Delivers**: KMS modesetting, hardware display control
### Milestone M4: "Wayland compositor validation with input + display" (2-4 weeks after M2+M3)
- Add Redox backends to the bounded validation compositor stack (input + DRM + EGL)
- Build the bounded validation compositor path with Redox backends
- **Test**: Validation compositor takes over display, keyboard/mouse work
- **Delivers**: Bounded Wayland compositor proof on Redox, not the final production desktop path
### Milestone M5: "Qt application runs" (6-8 weeks after M4)
- Port `qtbase` with Wayland QPA
- Port `qtwayland`, `qtdeclarative`
- **Test**: Qt widget app shows window on compositor
- **Delivers**: Qt development on Redox
### Milestone M6: "KDE app runs" (6-8 weeks after M5)
- Port KDE Frameworks (25 frameworks)
- Port one KDE app (e.g., Kate)
- **Test**: Kate editor opens and edits a file
- **Delivers**: KDE application ecosystem begins
### Milestone M7: "KDE Plasma desktop" (4-6 weeks after M6)
- Port KWin (DRM/Wayland backend)
- Port Plasma Shell
- Create `config/kde.toml`
- **Test**: Full Plasma session boots
- **Delivers**: KDE Plasma as a usable desktop
### Milestone M8: "Linux GPU drivers" (8-12 weeks, parallel track from M3)
- Build `linux-kpi` C headers
- Port i915 as proof of concept
- Port amdgpu for AMD support
- **Test**: amdgpu drives AMD GPU on Redox
- **Delivers**: Broad GPU hardware support via Linux driver ports
---
## Parallel Execution Plan
```
Week 1-4: M1 (relibc POSIX gaps)
Week 3-12: M2 (evdev input) ──── parallel ──── M3 (DRM/KMS)
Week 13-16: M4 (Wayland compositor = M2 + M3 + M1)
Week 13-24: M8 (Linux driver compat, parallel with M4-M6)
Week 17-24: M5 (Qt Foundation)
Week 25-32: M6 (KDE Frameworks)
Week 33-38: M7 (Plasma Desktop)
```
**Total to KDE Plasma**: ~38 weeks (~9 months) with 2 developers.
**Total to Linux driver compat**: ~24 weeks (~6 months) in parallel.
## Critical Path
```
M1 (POSIX) ──────────────────────────────────────┐
M3 (DRM/KMS) ─────────── M4 (Compositor) ── M5 (Qt) ── M6 (KDE) ── M7 (Plasma)
│ ↑ │
M2 (Input) ──────────────┘ M8 (Linux drivers, parallel)
```
**Shortest path to a desktop**: M1 → M2 → M3 (parallel) → M4 → M5 → M6 → M7
**Shortest path to GPU drivers**: M3 → M8 (can start as soon as `redox-driver-sys` exists)
-1
View File
@@ -24,7 +24,6 @@ For current Red Bear OS status, also read:
```
docs/
├── 01-REDOX-ARCHITECTURE.md # Architecture reference: microkernel, scheme system, driver model, display architecture
├── 02-GAP-ANALYSIS.md # Historical gap matrix with corrected current-state notes
├── 04-LINUX-DRIVER-COMPAT.md # Driver-compat architecture reference + historical porting path
├── 05-KDE-PLASMA-ON-REDOX.md # Historical KDE implementation path + deeper rationale
├── 06-BUILD-SYSTEM-SETUP.md # Build/setup mechanics guide (not canonical policy)
+2 -3
View File
@@ -40,7 +40,7 @@ current/canonical versus historical/reference split obvious.
| `README.md`, `AGENTS.md`, `docs/README.md`, `docs/07-RED-BEAR-OS-IMPLEMENTATION-PLAN.md` | canonical repository-level policy and current execution model |
| `local/docs/*IMPLEMENTATION-PLAN*.md`, `local/docs/*STATUS*.md`, `local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md`, `local/docs/DRM-MODERNIZATION-EXECUTION-PLAN.md` | canonical current Red Bear subsystem plans and status |
| `docs/01-REDOX-ARCHITECTURE.md` | architecture reference |
| `docs/02-GAP-ANALYSIS.md`, `docs/04-LINUX-DRIVER-COMPAT.md`, `docs/05-KDE-PLASMA-ON-REDOX.md` | valuable but partly historical roadmap/design material |
| `docs/04-LINUX-DRIVER-COMPAT.md`, `docs/05-KDE-PLASMA-ON-REDOX.md` | valuable but partly historical roadmap/design material |
When a current-state local document conflicts with an older historical public roadmap, prefer the
current local subsystem plan.
@@ -50,7 +50,6 @@ current local subsystem plan.
| # | Document | Description |
|---|----------|-------------|
| 01 | [Architecture Overview](01-REDOX-ARCHITECTURE.md) | Architecture reference for Redox internals: microkernel, scheme system, driver model, display stack |
| 02 | [Gap Analysis & Roadmap](02-GAP-ANALYSIS.md) | Historical gap matrix plus corrected current phase summary |
| 04 | [Linux Driver Compatibility Layer](04-LINUX-DRIVER-COMPAT.md) | Historical/current hybrid design reference for the LinuxKPI-style driver compatibility model |
| 05 | [KDE Plasma on Redox](05-KDE-PLASMA-ON-REDOX.md) | Historical KDE implementation path plus deeper KDE-specific rationale |
| 06 | [Build System Setup](06-BUILD-SYSTEM-SETUP.md) | How to build Redox from this repository |
@@ -68,7 +67,7 @@ current local subsystem plan.
- `../local/docs/BLUETOOTH-IMPLEMENTATION-PLAN.md` — current Bluetooth architecture and rollout plan
- `../local/docs/BLUETOOTH-VALIDATION-RUNBOOK.md` — canonical operator path for the bounded Bluetooth Battery Level QEMU validation slice
- `../local/docs/ACPI-IMPROVEMENT-PLAN.md` — current ACPI ownership, robustness, and validation plan
- `../local/docs/ACPI-FIXES.md` — historical P0 ACPI bring-up ledger and status record
- `../local/docs/ACPI-IMPROVEMENT-PLAN.md` — current ACPI ownership, robustness, and validation plan
- `../local/docs/IRQ-AND-LOWLEVEL-CONTROLLERS-ENHANCEMENT-PLAN.md` — canonical current plan for PCI/IRQ quality, low-level controller robustness, MSI/MSI-X follow-up, and controller runtime-proof sequencing
- `../local/docs/DRM-MODERNIZATION-EXECUTION-PLAN.md` — current DRM-focused execution plan beneath the canonical desktop path, with equal Intel/AMD evidence bars
- `../local/docs/WAYLAND-IMPLEMENTATION-PLAN.md` — canonical Wayland subsystem plan beneath the desktop path
-368
View File
@@ -1,368 +0,0 @@
Red Bear OS Packaging System — Formal Spec v0.1
0. Guiding Principles
Native-first
All builds target: x86_64-unknown-redox
All install artifacts: pkgar packages
Cookbook is the build engine
RBPKGBUILD = thin wrapper over Cookbook recipe
PKGBUILD is input, not execution
Never execute arbitrary PKGBUILD on host
Always convert → RBPKGBUILD → Cookbook
Single tool
cub = one CLI binary with subcommands/flags
Deterministic builds
Controlled env
No implicit host dependencies
Security-first
Sandbox builds
Review BUR packages before install
1. RBPKGBUILD Specification
1.1 File Format
Format: TOML
Filename: RBPKGBUILD
Versioned schema
format = 1
1.2 Top-Level Sections
format = 1
[package]
[source]
[dependencies]
[build]
[install]
[patches]
[compat]
[policy]
1.3 [package]
[package]
name = "ripgrep"
version = "14.1.0"
release = 1
description = "Fast recursive search tool"
homepage = "https://github.com/BurntSushi/ripgrep"
license = ["MIT", "Unlicense"]
architectures = ["x86_64-unknown-redox"]
maintainers = ["name <email>"]
Rules
name: lowercase, [a-z0-9-_]+
version: upstream version
release: integer (Red Bear-specific revision)
architectures: must include x86_64-unknown-redox
1.4 [source]
[source]
sources = [
{ type = "tar", url = "...", sha256 = "..." },
{ type = "git", url = "...", rev = "..." }
]
Supported types
tar
git
Rules
All sources must be verifiable (hash or commit)
No implicit downloads during build
1.5 [dependencies]
[dependencies]
build = ["cargo", "rust"]
runtime = []
check = []
optional = []
provides = []
conflicts = []
Rules
Names must resolve via system mapping
Must not reference Arch package names directly
1.6 [build]
Maps directly to Cookbook templates.
[build]
template = "cargo" # or configure, cmake, meson, custom
Optional fields
cargo
[build]
template = "cargo"
release = true
features = []
configure
[build]
template = "configure"
args = ["--prefix=/usr"]
cmake
[build]
template = "cmake"
build_dir = "build"
custom
[build]
template = "custom"
prepare = [
"patch -p1 < patches/fix.patch"
]
build = [
"make -j$CORES"
]
check = [
"make test"
]
install = [
"make DESTDIR=$DESTDIR install"
]
1.7 [install]
Declarative install mapping.
[install]
bins = [
{ from = "target/.../rg", to = "/usr/bin/rg" }
]
libs = []
headers = []
docs = ["README.md"]
man = []
Rules
All paths relative to build output
Must install into staged root (DESTDIR)
1.8 [patches]
[patches]
files = [
"patches/0001-fix-redox.patch"
]
1.9 [compat]
Tracks conversion origin.
[compat]
imported_from = "aur"
original_pkgbuild = "PKGBUILD"
conversion_status = "partial" # full | partial | manual
target = "x86_64-unknown-redox"
1.10 [policy]
[policy]
allow_network = false
allow_tests = true
review_required = true
2. .RBSRCINFO (Metadata Cache)
Purpose
Fast search/index
No recipe parsing needed
Format (INI-like)
pkgname = ripgrep
pkgver = 14.1.0
pkgrel = 1
pkgdesc = Fast recursive search tool
arch = x86_64-unknown-redox
depends =
makedepends = cargo rust
source = https://...
sha256sums = ...
provides =
conflicts =
3. BUR Repository Spec
Structure
ripgrep/
RBPKGBUILD
.RBSRCINFO
patches/
import/
PKGBUILD
report.txt
4. cub CLI Specification
4.1 General
Single binary: cub
Rust implementation
Subcommands via flags (not separate tools)
4.2 Core Commands
Search
cub -Ss <query>
Install
cub -S <package>
Resolution order:
official repo
BUR (RBPKGBUILD)
AUR import (optional flag)
Build local
cub -B .
Fetch recipe
cub -G <package>
Inspect
cub -Pi <package|RBPKGBUILD>
Update system
cub -Sua
Clean cache
cub -Sc
Convert AUR
cub --import-aur <url|name>
Outputs:
RBPKGBUILD
patches/
report.txt
5. PKGBUILD → RBPKGBUILD Conversion
5.1 Conversion Stages
Stage 1 — Parse
Extract:
pkgname
pkgver
depends
source
functions
Stage 2 — Normalize
Resolve arrays
Expand variables
Strip bash constructs
Stage 3 — Map
PKGBUILD RBPKGBUILD
pkgname package.name
pkgver package.version
depends dependencies.runtime
makedepends dependencies.build
source source.sources
Stage 4 — Detect build system
Patterns:
Pattern Template
cargo build cargo
./configure configure
cmake cmake
meson meson
none custom
Stage 5 — Generate RBPKGBUILD
Fill required fields
Insert detected template
Add compat section
Stage 6 — Patch generation
If:
/usr/lib/systemd
/proc
systemctl
→ generate:
patch stub
warning entry
Stage 7 — Report
report.txt
Conversion: PARTIAL
Warnings:
- Uses systemd
- Hardcoded /usr/lib
Actions required:
- Patch install paths
- Remove systemctl usage
5.2 Conversion Modes
Mode Description
full fully automated
partial needs patches
manual user intervention
6. Build Execution
Environment
TARGET=x86_64-unknown-redox
GNU_TARGET=x86_64-redox
DESTDIR=/build/stage
PREFIX=/usr
CORES=8
Sandbox Rules
No network after fetch
Isolated filesystem
No host writes
Controlled PATH
Execution Flow
cub
→ parse RBPKGBUILD
→ generate Cookbook recipe
→ run build
→ stage files
→ create pkgar
→ install
7. Dependency Mapping
Mapping file
[mapping]
glibc = "relibc-compat"
base-devel = "build-base"
8. Error Handling
Hard Fail
Missing source hash
Unknown build template
Unsupported architecture
Soft Fail (warn)
Linux-specific paths
missing tests
partial conversion
9. Security Model
BUR = untrusted
Require review on first install
Signed packages preferred
Build sandbox enforced
10. MVP Scope
MUST implement
RBPKGBUILD parser
Cookbook adapter
pkgar integration
cub CLI core commands
basic AUR conversion
dependency mapping
sandbox build
MUST NOT implement yet
full PKGBUILD shell compatibility
split packages
pacman compatibility
hook system
11. Final Definition
RBPKGBUILD is a declarative Red Bear build wrapper over Cookbook recipes.
cub is a Rust CLI tool that manages installation, building, and conversion from AUR PKGBUILD into RBPKGBUILD, using BUR as the community repository.
All builds target x86_64-unknown-redox and produce pkgar packages.