1460 Commits

Author SHA1 Message Date
vasilito 520e92cad8 chore: checkpoint before 0.2.3 build system migration 2026-05-29 21:53:11 +03:00
vasilito aa9d14a90e docs: update AGENTS.md and PATCH-GOVERNANCE.md
AGENTS.md: updated session progress, coretempd/login fix notes, Intel plan references. PATCH-GOVERNANCE.md: added mega-patch discipline section and P-patch workflow documentation.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-29 21:50:28 +03:00
vasilito 44bcf2b75a docs: add Intel driver modernization plan
Comprehensive 6-phase plan (1,055 lines) for updating the Intel GPU driver from current 1,590-line stub to full Gen9+ support ported from Linux 7.1 i915. Covers register abstraction, GMBUS I2C, DMC firmware, power wells, CDCLK, display pipeline, modesetting, and hardware validation.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-29 21:50:07 +03:00
vasilito 7cd5bfbb83 fix: enable redox-rt proc feature in userutils to fix login crash
userutils compiled redox-rt with default-features=false, disabling the proc feature. This caused login's fork to not pass proc fd to child shell, triggering assertion failed: info.has_proc_fd in redox-rt. P8 patch enables features=['proc']. Verified: zero panics on boot, login works for user/root.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-29 21:49:47 +03:00
vasilito 5987fffde7 fix: P12 init_debug import error in base init
The init_debug macro was used without importing it, causing a compile error. P12 patch adds the missing import. Wired into base recipe.toml patches list.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-29 21:49:07 +03:00
vasilito 706050482b fix: rewrite coretempd to use redox_scheme Socket + SchemeSync
Replaced broken UnixListener::bind(':coretemp') with proper redox_scheme::Socket::create() + SchemeSync trait impl. Event loop uses next_request/handle_sync/write_response pattern. Verified: registers scheme:coretemp, detects CPU info, zero panics.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-29 21:48:51 +03:00
vasilito daf131d435 P7 login diagnostics, P11 init noise reduction, config layering fix 2026-05-29 19:13:16 +03:00
vasilito 0ccc233131 P10: fix Arrow Lake device IDs and DMC firmware mapping
The driver incorrectly labeled Lunar Lake IDs (0x6420/64A0/64B0) as
Arrow Lake, and placed the real Arrow Lake IDs (0x7D41/7D51/etc.) in the
Meteor Lake bucket. This meant:
- Arrow Lake notebooks were misidentified as Meteor Lake
- Lunar Lake was completely missing from the device tables
- The 0xB640 ID (ARL-H) was also misfiled

Fix:
- Move real Arrow Lake IDs (0x7D41, 0x7D51, 0x7DD1, 0x7D67, 0xB640)
  to INTEL_GEN12_ARL_IDS
- Move Lunar Lake IDs (0x6420, 0x64A0, 0x64B0) to INTEL_GEN12_LNL_IDS
- Map Arrow Lake DMC firmware to INTEL_MTL_DMC_KEYS (mtl_dmc.bin),
  since Arrow Lake uses the same display IP 14.0 as Meteor Lake
- Remove Arrow Lake IDs from the Meteor Lake bucket

Per Linux 7.1 reference: Arrow Lake display engine is IP 14.0 (Xe_LPD+),
same as Meteor Lake — NOT Xe2. The i915-style register programming is
correct for Arrow Lake.
2026-05-29 17:49:11 +03:00
vasilito c0a93e5cfa Add input driver init services and driver-manager configs
- ps2d: PS/2 keyboard/mouse (init service + driver-manager wildcard match)
- i2c-hidd: I2C HID keyboard/touchpad (init service + driver-manager match)
- intel-thc-hidd: Intel Touch Host Controller HID (init service + PCI match)

Fixes i2c-hidd path: /usr/bin/i2c-hidd (not /usr/lib/drivers/).

These drivers were already built in the base package but were not wired
into the boot process. Modern Intel notebooks typically use either
i8042 EC emulation (PS/2) or I2C HID for keyboard/touchpad.
2026-05-29 15:44:35 +03:00
vasilito 0a4a77a56b P27: add missing proc.rs guard.caps derivation from euid
The capability bitmask patch was missing the critical proc.rs hunk that
derives caps from euid when procmgr writes ProcSchemeAttrs to a child
context. Without this, all child processes had caps=0, causing
EACCES on dup("create-scheme") and crashing boot.

Fix: in ContextHandle::Attr kwrite path, after setting euid/egid/pid/prio,
set guard.caps = CAP_ALL when euid==0, else 0.
2026-05-29 14:25:37 +03:00
vasilito d2c761a56c fix: P27 caps init + P6 type errors and overlap with P5
P27: add caps: 0 to Context::new() default initialization.
P6: fix syscall::Error vs libredox::Error type mismatch (use ?),
    fix usize->u32 casts for Resugid fields, remove P5 overlap
    (issue/motd/consecutive_failures already in P5), add namespace
    isolation to password-verified auth path.

All 39 kernel patches validate. Full image builds.
2026-05-29 12:24:51 +03:00
vasilito f40b751bca fix: regenerate P27 kernel capability patch against clean P0-P26 baseline
P27-capability-bitmask.patch was generated against an incorrectly
patched source tree, causing hunk mismatches in validate-patches.
Regenerated from clean upstream + P0-P26 baseline using git diff -U0 -w.

All 39 patches now validate successfully.
2026-05-29 11:37:22 +03:00
vasilito ce9ff8aebd feat: Phase 2 - kernel capability bitmask (uid==0 -> has_cap())
Replace all 9 kernel uid==0 privilege checks with a capability bitmask
model. Adds caps:u64 field to Context and CallerCtx, with CAP_ALL for
root processes. Zero behavioral change - uid==0 still gets all caps.

New module: src/scheme/caps.rs with 10 capability constants.
9 check sites converted: acpi, irq, memory, debug, serio, sys (msr+write),
scheme registration, and fchown.

Patch: local/patches/kernel/P27-capability-bitmask.patch
2026-05-29 10:25:09 +03:00
vasilito bb3ae6e63f feat: Phase 1 - Plan 9 namespace privilege drop + branding
- login.rs: drop privileges via setresugid after authentication
- login.rs: add namespace isolation to password auth path (was missing)
- login.rs: add drm, input schemes to DEFAULT_SCHEMES
- sudo service: rename 00_sudo -> 12_sudo, type daemon (no boot block)
- Branded login screen with figlet RedBear OS v0.2.2 'Liliya'
- Root user kept but not advertised on login screen
- P6-login-privilege-drop.patch generated and wired

Implements Phase 1 of Plan 9 namespace privilege model:
login creates restricted namespace (mkns/setns) then drops
uid/gid to authenticated user before spawning shell.
2026-05-29 09:54:28 +03:00
vasilito 61135b0cce chore: bump OS version to 0.2.2 2026-05-29 09:06:24 +03:00
vasilito 9db9c3bdc9 feat: ISO size reduction, user account, SDDM, PAM, VirtIO fixes, KDE/Qt patches
- Trim redbear-firmware from 1816MB to 143MB (GPU+WiFi only)
- Reduce filesystem_size from 8192 to 2048 MB
- Add unprivileged user account (uid=1000, sudo group)
- Add SDDM display manager recipe with Wayland-only patches
- Add pam-redbear PAM module for authentication
- Fix VirtIO queue timeout (SeqCst fence, remove permanent failure)
- KDE/KWin build fixes (libinput, wayland socket, ramfile, tabletmode)
- Qt6 build fixes (platformdefs, socket engine, Wayland integration)
- KF6 CMake fixes (attica, kcmutils, kcolorscheme, kcompletion, etc.)
- libxml2 build fix, libxkbcommon recipe fix
- Remove gcc-native/binutils-native from desktop ISO
2026-05-29 09:00:55 +03:00
vasilito 845ae99f9d fix graphical boot: DRM scheme detection, ConsoleKit bypass, boot chain deps
Three fixes for the KWin DRM device discovery failure:

1. drm_scheme_ready(): replace head -c 1 with exec 3< open test.
   Reading from a DRM scheme fd blocks because the scheme expects
   ioctl-style request/response, not streaming reads. Use open()
   success as the scheme availability probe instead.

2. ConsoleKitSession::create(): return nullptr immediately.
   The D-Bus isServiceRegistered() call can block indefinitely when
   the bus daemon doesn't fully implement org.freedesktop.DBus.
   With both LogindSession and ConsoleKitSession returning nullptr,
   Session::create() falls through to NoopSession which uses plain
   open() for DRM device access.

3. Boot chain deps: redox-drm depends on driver-manager,
   greeter depends on evdevd (keyboard/mouse ready before login).

Also includes: KF6 CMake build fixes, Qt6 platform patches,
libdrm Redox ioctl shim, and wayland.toml scheme check fix.
2026-05-28 23:19:49 +03:00
vasilito 5c5f853192 fix: correct libdrm patch relative paths for symlink resolution
The cookbook resolves patch paths from recipe.dir which is the symlink
path (recipes/libs/libdrm/), not the physical path (local/recipes/).
Fix ../../../patches/libdrm/ → ../../../local/patches/libdrm/ to
match the convention used by kernel, base, relibc, and other recipes.
2026-05-28 18:36:57 +03:00
vasilito ece9837d15 fix: auto-discover all local recipes in integrate-redbear.sh
Replace 95-line manual symlink list with auto-discovery of all
local/recipes/<category>/<name>/ directories. This fixes 15 missing
symlinks that would have blocked the redbear-full build, including
critical packages: libdrm, qtbase, qtwayland, libinput, libevdev,
seatd, and wayland-protocols.

Special-case aliases preserved:
- kf6-kirigami → kirigami (KDE expects both names)
- wip/wayland/qt6-wayland-smoke (historical WIP path)
2026-05-28 18:31:21 +03:00
vasilito d26675708e Phase 4: RAM-disk boot, recipe catalog, collision validation
L1: Add make qemu-ram target — copies disk image to host tmpfs before
    QEMU boots, eliminating host disk I/O during OS runtime.
    Usage: make qemu-ram CONFIG_NAME=redbear-full QEMU_MEM=12288

L2: Create local/recipes/AGENTS.md — comprehensive catalog of all 165
    custom recipes across 15 categories with descriptions.

L3: CollisionTracker already fully implemented and wired into installer
    (recipes/core/installer/source/src/collision.rs, 267 lines).

L4: Add scripts/validate-collision-log.sh to make validate target —
    scans build logs for [COLLISION-ERROR]/[COLLISION-WARN] markers
    from the runtime CollisionTracker.
2026-05-28 18:16:48 +03:00
vasilito 2d11c98428 fix: add 8 missing recipes to protected-recipes.toml
Missing from initial TOML conversion:
- kf6-ksvg, kf6-pty, kf6-notifyconfig, kf6-parts (KDE frameworks)
- kglobalacceld (KDE global accelerator daemon)
- redbear-keymapd, redbear-ime, redbear-accessibility (input services)

Total protected recipes: 119 (matches original hardcoded list)
2026-05-28 17:54:07 +03:00
vasilito 5c127bf6f4 fix stale config names in 13 test/validation scripts
redbear-minimal -> redbear-mini (config renamed, old name never existed as file)
redbear-desktop -> redbear-full (desktop is the full target)
redbear-live-full/redbear-live-minimal -> removed (never existed)

Also fix verify-overlay-integrity.sh critical config list:
- Remove 4 nonexistent configs (redbear-live-full, redbear-live-minimal, redbear-desktop)
- Add 2 missing configs (redbear-grub, redbear-grub-policy, redbear-boot-stages)
2026-05-28 17:46:52 +03:00
vasilito a0244075e7 build system audit: implement Phase 1-3 fixes comprehensively
Phase 1 (Critical):
- Fix broken config includes: redbear-minimal -> redbear-mini in wifi/bt experimental configs
- Fix 05_boot-essential.target dependency: 00_base -> 04_drivers for correct boot ordering
- Fix IOMMU service dependency: 00_base -> 05_boot-essential
- Fix firmware-loader dependency: 00_base -> 05_boot-essential
- Fix messagebus shell: /usr/bin/zsh -> /usr/bin/false (security)
- Add offline gate to fetch-firmware.sh (REPO_OFFLINE=1 blocks network access)
- Add --upstream gate to fetch-all-sources.sh (network access requires explicit opt-in)
- Gate U-Boot wget calls in mk/qemu.mk with REPO_OFFLINE check
- Fix patch-inclusion-gate.sh: rewrite from Python deps to pure shell implementation
- Fix build-redbear.sh: remove direct patch application, let repo fetch handle it atomically

Phase 2 (High):
- Increase redbear-full filesystem_size: 4096 -> 8192 MiB for KDE desktop
- Deprecate redbear-greeter-services.toml (orphaned, not included by any config)
- Add cascade rebuild target to Makefile (make cascade.<package>)
- Gate cargo-update.sh with REDBEAR_ALLOW_UPSTREAM
- Add deprecation notice to apply-patches.sh
- Make protected recipe list data-driven via config/protected-recipes.toml
- Replace 127-entry hardcoded Rust matches! with TOML config file reader

Phase 3 (Medium):
- Fix 5 phantom doc references in local/AGENTS.md (retired/removed docs)
- Fix stale config names: redbear-minimal -> redbear-mini across scripts
- Fix duplicate references in docs/README.md
- Fix run_full.sh and run_mini.sh: hardcoded paths -> relative paths + error handling
2026-05-28 17:24:50 +03:00
vasilito 2b11b20a2f libdrm: fix drmGetDeviceFromDevId for Redox (P4)
Add #ifdef __redox__ path to drmGetDeviceFromDevId() that mirrors the
working drmGetDevice2() Redox implementation. On Redox there is no
/dev/dri/ directory — DRM devices are accessed via /scheme/drm/card0.
The patch constructs a drmDevice with both PRIMARY and RENDER nodes
pointing to /scheme/drm/card0, since the redox-drm scheme serves both
roles through a single endpoint.

Also fixes drmParseSubsystemType() to return DRM_BUS_PCI on Redox.

Fix P3 patch paths (strip local/recipes/libs/libdrm/source/ prefix
from diff headers so patches apply correctly during repo fetch).
2026-05-28 16:35:16 +03:00
vasilito cb50169517 P0-P3 baseline for P4 2026-05-28 15:49:45 +03:00
vasilito 328d1abbcd rate-limit scheme error spam to prevent serial log flood 2026-05-28 00:36:17 +03:00
vasilito 3583ee0186 Fix logd panic: hard-depend on randd (P58)
logd was starting before randd, causing a panic when the Rust std
library tried to get random data from /scheme/rand which didn't
exist yet. This cascaded into fbbootlogd failing (no log scheme)
and vesad timing out, blocking the console/getty chain entirely.

P58 adds:
- 00_logd.service: requires = ["00_randd.service"]
- 20_fbbootlogd.service: requires = ["00_logd.service"]

Result: mini ISO boots to RedBear Login: prompt with working
console, D-Bus, driver-manager, and all boot stage markers.
2026-05-27 07:53:32 +03:00
vasilito 475067ca8b Merge master graphics stack into 0.2.0
- config/redbear-full.toml: take master version with Intel GPU + VirtIO GPU
  pcid configs for automatic redox-drm loading, corrected requires_weak
  targets, removed incorrect default_dependencies=false, improved D-Bus/
  sessiond/seatd dependency chain
- kf6-extra-cmake-modules: minor cmake flag cleanup (remove BUILD_DOC=OFF)

Kept bootprocess redox-drm source (superior: 128-byte EDID with valid
checksum, safe MMIO pipeframe reads with bounds checks). All other
graphics recipes (Mesa, libdrm, Wayland, Qt6, KF6, KDE) already
identical between branches.
2026-05-27 07:33:45 +03:00
vasilito b9de373b31 Merge bootprocess branch overlay into 0.2.0
Restore all bootprocess branch files that were overwritten by later 0.2.0
commits. This overlay brings back the complete boot infrastructure:

- Configs: redbear-full, redbear-mini, redbear-device-services, driver .d files
- Kernel: IRQ affinity, x2APIC, C-states, NUMA (SLIT/SRAT), MCS locks, cpuidle
- Base patches: P0-P55 + new P6 (lived block_size=512) + P57 (fbbootlogd graceful init)
- Driver infra: driver-manager, udev-shim, thermald, cpufreqd, iommu, redox-driver-sys/core
- GPU: redox-drm with improved connector handling
- System: redbear-info, redbear-hwutils phase-timer-check
- Build system: fetch.rs improvements, build-iso.sh, run_full.sh
- Kernel source: new ACPI (SLIT, SRAT), cpuidle, cstate, MCS lock modules

83 files changed, +3966/-1248 lines
2026-05-27 06:47:23 +03:00
vasilito af05babbb2 WIP: recipe patches, expat/libxml2/libmpfr autogen, kf6/qt cmake fixes, new relibc patches 2026-05-26 06:56:30 +03:00
vasilito 899dcb810c Merge master into 0.2.0 - 688 commits merged, restore 0.2.0 local dev recipes 2026-05-21 23:12:35 +03:00
vasilito 0c8be761eb Merge master into 0.2.0 (688 commits, theirs pref for conflicts) 2026-05-21 21:37:43 +03:00
vasilito 7e21799845 Add low-level infrastructure reassessment and updated plan v1.0 2026-05-21 05:36:35 +03:00
vasilito 5715f86dc6 Add P55: JSON structured log format option to logd
When LOGD_JSON=1 is set in the environment, logd formats all log
lines as JSON objects with timestamp, source, and message fields.
Also fixes indentation issues in P51 logd rotation patch.
2026-05-21 00:48:13 +03:00
vasilito 54a33a7a15 Fix P51 logd-rotation patch line numbers
The service_logs declaration hunk was targeting line 48 instead of 49,
causing patch to insert it inside the let persistent_log chain instead
of inside the thread spawn closure.
2026-05-21 00:09:13 +03:00
vasilito 2e477bbc90 Fix P45 and P53 patch line numbers and missing dependencies
P53: Change itr_tracker insertion point from line 46 to 47
so it applies after NetworkScheme::new() closing, not inside it.

P45: Add log.workspace = true to ixgbed Cargo.toml since
P45 adds log::error! usage to ixgbed main.rs.
2026-05-20 23:56:25 +03:00
vasilito 4d914a0321 Add P46b fix for ac97d mutable pcid_handle borrow
P46 migrated ac97d to pci_allocate_interrupt_vector but missed
adding  to the pcid_handle parameter. This caused build
failure: cannot borrow pcid_handle as mutable.
2026-05-20 23:34:31 +03:00
vasilito 7c03b6dcc6 Fix P49 irq-affinity-logging patch line numbers and struct placement
The original P49 patch had incorrect line numbers that caused
patch --fuzz=3 to insert cpu_id field and methods at wrong locations,
corrupting irq_helpers.rs. Regenerate from clean P0-P48 baseline.
2026-05-20 23:25:51 +03:00
vasilito 95bbc56f97 base: Fix P48 pattern and add P54 thermal module
- P48: Fix AmlSerdeValue::Package pattern (struct variant, not tuple)
- P54: Add missing thermal.rs module referenced by P44
  ThermalState with zone discovery via ACPI _TMP evaluation
2026-05-20 22:53:08 +03:00
vasilito 17791421c4 redbear-info: Add thermal, fan, and C-state health dashboard items
Reads from /scheme/acpi/thermal/, /scheme/acpi/fan/, and /scheme/acpi/cstates/
plus /scheme/sys/cstate_policy to populate the --health dashboard with
hardware thermal status, fan activity, and CPU power-management state.
2026-05-20 22:20:47 +03:00
vasilito 0046c76e43 base: Add e1000d interrupt throttling rate (ITR) coalescing (P53)
Re-implements work that was lost due to ephemeral source/ subdirectory.
ITR dynamically adjusts interrupt coalescing based on packet rate.

- Add ITR register (0xC4) and set_itr() to device.rs
- Add itr.rs tracker with hysteresis-based rate adaptation
- Wire tracker into IRQ handler in main.rs
- Document in AGENTS.md: source/ is ALWAYS rewritten
2026-05-20 22:15:03 +03:00
vasilito ac2f1ccbc2 iommu: Add Intel VT-d daemon foundation (Phase 3.2)
- Add intel_vtd.rs module with DMAR parsing, DRHD discovery,
  register definitions, and basic unit initialization
- Update iommu daemon discovery to detect both AMD-Vi (IVRS)
  and Intel VT-d (DMAR) units
- Update IommuScheme to track both amd_units and intel_units
- Intel VT-d init: version check, capability read, disable
  translation, report supported features (QI, IR, EIM)

Full DMA remapping enablement (root table, context entries,
page tables, command buffer) remains as TODO for follow-up.
2026-05-20 21:13:03 +03:00
vasilito b2eaa8d96f base: Add ACPI C-state discovery and thermal-based C-state policy (P52)
- drivers/acpid/src/cstate.rs: Evaluate _CST per processor, parse
  Package-of-Packages into CStateInfo structs
- AcpiContext: add cstate_state field with refresh, add processor_names()
  to scan _PR namespace
- acpid scheme: expose /scheme/acpi/cstates/<proc> read handles
- thermald: read /scheme/sys/cstate, set /scheme/sys/cstate_policy
  to restrict to C1 when temp exceeds WARNING_TEMP

Works with kernel P25 cpuidle deep C-states.
2026-05-20 20:47:37 +03:00
vasilito 4fe34d543f baseline 2026-05-20 19:58:33 +03:00
vasilito 5f0c54ebfe baseline 2026-05-20 19:58:12 +03:00
vasilito 80c9bccc09 docs: Add hardware validation matrix template
Define 4 hardware target classes (AMD/Intel desktop/laptop),
per-target checklist, negative-result capture format, and
quick/full test procedures. Ready for bare-metal evidence.
2026-05-20 18:56:32 +03:00
vasilito 676a4342ce udev-shim: Only log hotplug events when device count changes
Track the last PCI device count and only emit log messages when
devices are added or removed, eliminating redundant 2-second poll
noise.
2026-05-20 18:52:43 +03:00
vasilito e5b82a644a coretempd: Add AMD Zen temperature sensor support
Detect CPU vendor by probing MSRs (Intel IA32_THERM_STATUS vs AMD
TCTL MSR C0010293). Support both Intel Tjmax-based and AMD direct
temperature reading. Log detected vendor per CPU at startup.
2026-05-20 18:52:01 +03:00
vasilito 2c7de8dea6 base: Add per-service log files and size-based rotation to logd (P51)
Extend logd output thread to write logs to per-service files in
/var/log/<service>.log, with automatic size-based rotation (10 MB
threshold, 5 backup files). All logs also go to /var/log/system.log.
Backwards compatible with existing sink file descriptors.
2026-05-20 18:39:49 +03:00
vasilito fb2de33c6d base: Add structured logging rate limiter and thermald integration (P50)
Add RateLimitedLog to common::logger for per-message rate limiting with
"last message repeated N times" warnings. Add structured_log! macro for
key=value formatted logs. Update thermald to rate-limit the max-temp
summary line (30s interval) to reduce log volume.
2026-05-20 18:14:47 +03:00