Add CUB implementation plan spec and update project documentation

New docs/_CUB_RBPKGBUILD_IMPL_PLAN.md with full CUB package builder specification
covering RBPKGBUILD format, CLI commands, build flow, BUR repository, and AUR conversion.
Updated AGENTS.md with pkgutils extensions and CUB integration details.
Updated AMD GPU integration docs with current P2 progress.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-12 23:52:47 +01:00
parent cefc9b8936
commit ba09482def
7 changed files with 476 additions and 30 deletions
+3 -3
View File
@@ -71,13 +71,13 @@ redox-master/ ← git pull updates mainline Redox
│ │ ├── core/ ← ext4d (ext4 filesystem scheme daemon + mkfs tool)
│ │ ├── branding/ ← redbear-release (os-release, hostname, motd)
│ │ ├── drivers/ ← redox-driver-sys, linux-kpi
│ │ ├── gpu/ ← redox-drm (AMD + Intel display drivers)
│ │ ├── gpu/ ← redox-drm (AMD + Intel display drivers), amdgpu (C port)
│ │ ├── system/ ← evdevd, udev-shim, firmware-loader, redbear-meta
│ │ ├── wayland/ ← Wayland compositor (Phase 4)
│ │ └── kde/ ← KDE Plasma (Phase 6)
│ ├── patches/
│ │ ├── kernel/ ← Kernel patches (ACPI, x2APIC)
│ │ ├── base/ ← Base patches (acpid fixes, power methods)
│ │ ├── base/ ← Base patches (acpid fixes, power methods, pcid /config endpoint)
│ │ ├── relibc/ ← relibc patches (POSIX: eventfd, signalfd, timerfd)
│ │ ├── bootloader/ ← Bootloader patches
│ │ └── installer/ ← Installer patches (ext4 filesystem support)
@@ -224,7 +224,7 @@ local/Assets/
| loading background.png | Boot splash | Convert to framebuffer-compatible format, display before orbital starts |
| loading background.png | Login screen | Set as orblogin/orbital background |
**Current status**: Assets are committed to git. Not yet integrated into the build — requires bootloader and display server changes (Phase 2+).
**Current status**: Assets are committed to git. Not yet integrated into the build — requires bootloader and display server integration (P2 hardware validation).
## ANTI-PATTERNS
+5 -5
View File
@@ -20,15 +20,15 @@ P0 ACPI work is **complete**. Kernel patch is 574 lines, base/acpid patch is 558
| DSDT (Differentiated System Description Table) | Parsed by `acpi` crate AML interpreter | Working | Platform-specific device config via AML bytecode |
| SSDT (Secondary System Description Table) | Parsed by `acpi` crate AML interpreter | Working | Secondary AML tables (hotplug, etc.) |
| FACP/FADT | ✅ Full parse in acpid | ✅ Done | PM registers, reset register, sleep states, `\_S5` |
| IVRS (AMD-Vi IOMMU) | Removed (broken stub) | Deferred to P2+ | Needs real AMD IOMMU implementation |
| MCFG (PCI Express config space) | Removed (broken stub) | Deferred to P2+ | Handled by pcid instead |
| IVRS (AMD-Vi IOMMU) | Removed (broken stub) | Deferred to P5+ | Needs real AMD IOMMU implementation |
| MCFG (PCI Express config space) | Removed (broken stub) | ✅ Handled by pcid | pcid /config endpoint provides direct PCI config space access |
| DBG2 (Debug port) | Not implemented | Low | Serial debug port discovery |
| BGRT (Boot graphics) | Not implemented | Low | Boot logo preservation |
| FPDT (Firmware perf data) | Not implemented | Low | Boot performance metrics |
IVRS and MCFG were previously listed as "implemented" but the stubs were broken. They have
been removed from acpid. IVRS needs a real AMD IOMMU driver (P2+ scope). MCFG is better
handled by pcid discovering PCIe config space directly.
IVRS was previously listed as "implemented" but the stub was broken. It has been removed
from acpid. IVRS needs a real AMD IOMMU driver (P5+ scope). MCFG is now handled by
pcid's /config endpoint (P1 complete) which provides direct PCI config space access.
## Implemented ACPI Tables
+53 -2
View File
@@ -23,11 +23,11 @@ the LinuxKPI compatibility approach — a clean Rust rewrite would take 5+ years
|-----------|--------|--------|
| UEFI boot | ✅ Works | x86_64 UEFI bootloader functional |
| AMD CPUs | ✅ Works | AMD 32/64-bit supported, Ryzen Threadripper verified |
| ACPI | ⚠️ Incomplete | Framework Laptop 16 crashes on unimplemented ACPI function |
| ACPI | ✅ Complete | RSDP/SDT checksums, MADT types 0x4/0x5/0x9/0xA, LVT NMI, FADT shutdown/reboot |
| x2APIC | ✅ Works | Auto-detected via CPUID, APIC/SMP functional |
| HPET | ✅ Works | Timer initialized from ACPI |
| IOMMU | ❌ Missing | No VT-d or AMD-Vi support |
| AMD GPU | ❌ Missing | Only VESA/GOP framebuffer, no acceleration |
| AMD GPU | 🚧 In progress | MMIO mapped, DC port compiles, MSI-X wired, no hardware validation yet |
| Wi-Fi/BT | ❌ Missing | No wireless support |
| USB | ⚠️ Variable | Some USB controllers work, others don't |
@@ -223,6 +223,57 @@ ONLY the display/modesetting portion first, using linux-kpi headers.
---
## P1/P2 IMPLEMENTATION STATUS (2026-04-12)
### P1: Driver Infrastructure — COMPLETE (compiles)
| Component | Status | Files |
|-----------|--------|-------|
| redox-driver-sys | ✅ | `local/recipes/drivers/redox-driver-sys/source/` — PCI, IRQ (MSI-X), MMIO, DMA |
| linux-kpi | ✅ | `local/recipes/drivers/linux-kpi/source/` — C compat headers + Rust shims |
| firmware-loader | ✅ | `local/recipes/system/firmware-loader/source/` — scheme:firmware daemon |
| pcid /config endpoint | ✅ | `local/patches/base/P0-pcid-config-endpoint.patch` — raw PCI config space via scheme:pci |
| MSI-X interrupt support | ✅ | `local/recipes/gpu/redox-drm/source/src/drivers/interrupt.rs` — shared MSI-X/legacy abstraction |
| Intel pcid-spawner config | ✅ | `local/config/pcid.d/intel_gpu.toml` — auto-detect Intel GPUs |
### P2: AMD GPU Display — COMPLETE (compiles, no HW validation)
| Component | Status | Files |
|-----------|--------|-------|
| redox-drm daemon | ✅ | `local/recipes/gpu/redox-drm/source/` — DRM scheme daemon |
| AMD driver (Rust) | ✅ | `local/recipes/gpu/redox-drm/source/src/drivers/amd/mod.rs` |
| AMD DisplayCore (FFI) | ✅ | `local/recipes/gpu/redox-drm/source/src/drivers/amd/display.rs` |
| AMD PCI stubs (dynamic) | ✅ | `local/recipes/gpu/amdgpu/source/redox_stubs.c` — populated from Rust via FFI |
| AMD DC init (C) | ✅ | `local/recipes/gpu/amdgpu/source/amdgpu_redox_main.c` — modesetting, connector detect |
| AMD glue headers | ✅ | `local/recipes/gpu/amdgpu/source/redox_glue.h` — Linux compat surface |
| GTT manager | ✅ | `local/recipes/gpu/redox-drm/source/src/drivers/amd/gtt.rs` |
| Ring buffer | ✅ | `local/recipes/gpu/redox-drm/source/src/drivers/amd/ring.rs` |
| GEM buffer mgmt | ✅ | `local/recipes/gpu/redox-drm/source/src/gem.rs` |
| DMA-BUF | ✅ | `local/recipes/gpu/redox-drm/source/src/dmabuf.rs` |
| Intel driver | ✅ | `local/recipes/gpu/redox-drm/source/src/drivers/intel/mod.rs` + `display.rs` |
### Build Verification
All crates compile with `cargo check` (0 errors):
- `redox-driver-sys`
- `linux-kpi`
- `redox-drm`
- `firmware-loader`
- `evdevd`
- `udev-shim`
- `ext4d`
### Next Steps (P2 → P3)
P2 code compiles but has NOT been validated on real hardware. Remaining:
1. Flash Red Bear OS image to USB, boot on AMD hardware with RDNA2/RDNA3 GPU
2. Verify pcid exposes `/scheme/pci/{addr}/config` and MSI-X vectors allocate
3. Verify redox-drm detects GPU, maps MMIO, initializes DC
4. Test connector detection and modesetting via scheme:drm
5. Begin P3 (POSIX gaps + evdevd) in parallel with hardware validation
---
## PHASE 3: INPUT + POSIX (4-8 weeks, parallel with Phase 2)
### P3-1: relibc POSIX Gaps (2-4 weeks)
+30 -6
View File
@@ -25,7 +25,7 @@ DRM scheme daemon. Registers scheme:drm/card0.
- GEM: buffer object create/mmap/close
- Dispatches to AMD driver backend
### amdgpu source (local/recipes/gpu/amdgpu-source/)
### amdgpu C port (local/recipes/gpu/amdgpu/source/)
AMD GPU driver source extracted from Linux 7.0-rc7:
- drivers/gpu/drm/amd/ — full AMD driver (269k lines)
- drivers/gpu/drm/ttm/ — TTM memory manager
@@ -38,11 +38,10 @@ Compiles AMD DC display code against linux-kpi headers with -D__redox__:
- redox_glue.h — type compatibility, function stubs, macro replacements
- redox_stubs.c — C implementations of Linux kernel API stubs
- amdgpu_redox_main.c — daemon entry point replacing module_init
- Makefile.redox — standalone build for development
## Build Integration
Config: local/config/my-amd-desktop.toml
Config: config/redbear-desktop.toml (includes desktop.toml + Red Bear GPU packages)
- Includes redox-drm and amdgpu packages
- filesystem_size = 8196 (8GB, needs space for firmware blobs)
@@ -89,9 +88,12 @@ pcid: local/config/pcid.d/amd_gpu.toml
|------|---------|
| local/recipes/gpu/redox-drm/ | DRM scheme daemon |
| local/recipes/gpu/amdgpu/ | Build recipe + integration glue |
| local/recipes/gpu/amdgpu-source/ | AMD driver source (from Linux 7.0-rc7) |
| local/config/my-amd-desktop.toml | Build config |
| local/config/pcid.d/amd_gpu.toml | PCI auto-detection |
| local/recipes/gpu/amdgpu/source/ | AMD driver C port source (from Linux 7.0-rc7) |
| config/redbear-desktop.toml | Build config |
| local/config/pcid.d/amd_gpu.toml | PCI auto-detection (AMD) |
| local/recipes/gpu/redox-drm/source/src/drivers/interrupt.rs | MSI-X/legacy interrupt abstraction |
| local/config/pcid.d/intel_gpu.toml | Intel GPU PCI auto-detection |
| local/patches/base/P0-pcid-config-endpoint.patch | pcid /config file endpoint |
| local/scripts/build-amd.sh | Build wrapper |
| local/scripts/test-amd-gpu.sh | Test script |
@@ -102,3 +104,25 @@ pcid: local/config/pcid.d/amd_gpu.toml
| redox-driver-sys | ✅ | MmioRegion, PciDevice, IrqHandle, DmaBuffer |
| linux-kpi | ✅ | C headers, FFI stubs (kmalloc, mutex, spinlock...) |
| firmware-loader | ✅ | scheme:firmware daemon |
## P1/P2 Changes Since Initial Implementation
### pcid /config endpoint (T1)
- Added `Config { addr: PciAddress }` handle to pcid scheme
- Routes `/scheme/pci/{addr}/config` to raw PCI config space read/write
- Enables redox-driver-sys PciDevice to access config space for MSI-X, BAR parsing
### MSI-X interrupt support (T2-T4)
- Created shared `InterruptHandle` enum in `redox-drm/src/drivers/interrupt.rs`
- Tries MSI-X first (find capability → parse → map table → mask_all → enable → request_vector)
- Falls back to legacy IRQ if MSI-X unavailable
- Both AMD and Intel drivers use `InterruptHandle::setup()`
### Dynamic PCI device info (T6)
- Replaced hardcoded `redox_pci_find_amd_gpu()` stub with `redox_pci_set_device_info()`
- Rust side passes real PciDeviceInfo (vendor, device, revision, IRQ, BAR0/BAR2) to C via FFI
- C layer validates the struct is populated before `amdgpu_redox_init()` uses it
### Intel GPU support (T4-T5)
- Intel driver switched to shared `InterruptHandle` (MSI-X + legacy)
- Added `local/config/pcid.d/intel_gpu.toml` for auto-detection (vendor 0x8086, class 0x03)