1445 Commits

Author SHA1 Message Date
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
vasilito 3890840001 base: Add IRQ affinity logging and CPU tracking to pcid (P49)
Track the target CPU ID in InterruptVector, and log the interrupt type
(MSI-X/MSI/Legacy) and CPU affinity at allocation time in
pci_allocate_interrupt_vector. Add log_affinity() helper for drivers
to call after setup.
2026-05-20 17:55:36 +03:00
vasilito b360748b82 base: Add ACPI fan device discovery and status exposure (P48)
Add fan.rs module to acpid that discovers FAN* devices under \_TZ,
evaluates _FST for current speed level and RPM, and exposes them via
/scheme/acpi/fan/<name>/status. Update thermald to read and log fan
status alongside temperature sensors.
2026-05-20 17:47:39 +03:00
vasilito ad2e85079d base: Update thermald to use P44 thermal zones and coretempd (P47)
Replace the old hardcoded /scheme/acpi/thermal_zone/{n} paths with
proper discovery of /scheme/acpi/thermal/ zones and /scheme/coretemp/
CPU temperatures. Logs per-zone and per-CPU temps with max tracking.
2026-05-20 17:23:19 +03:00
vasilito 1a0a684765 base: Migrate ahcid and ac97d to MSI-X interrupts (P46)
Switch storage and audio drivers from legacy INTx to
pci_allocate_interrupt_vector which auto-prefers MSI-X > MSI > Legacy.
2026-05-20 17:12:51 +03:00
vasilito e178e0fd86 base: Migrate e1000d and ixgbed to MSI-X interrupts (P45)
Switch network drivers from legacy INTx to pci_allocate_interrupt_vector
which auto-prefers MSI-X > MSI > Legacy. rtl8139d and rtl8168d already
used this helper; e1000d and ixgbed were the remaining legacy-only NIC
drivers.
2026-05-20 17:03:05 +03:00
vasilito bb4f757ba0 kernel: Add MONITOR/MWAIT C1 idle support (P24)
Implement CPU power-saving idle loop using x86 MONITOR/MWAIT:
- Add monitor(), mwait(), enable_and_mwait() to interrupt module
- Detect MWAIT availability via CPUID at boot
- Use MONITOR+MWAIT instead of STI+HLT when supported
- Expose /scheme/sys/cstate_policy for userspace control
- Add RdWr Kind variant to sys scheme for read+write files
2026-05-20 16:49:48 +03:00
vasilito 4fe734d1c2 fix: Regenerate P44 patch with clean upstream baseline
Previous P44 was generated against an already-patched tree causing
validation failures. Regenerated using git diff -U0 -w against
P0-P43 baseline.
2026-05-20 14:11:00 +03:00
vasilito 0834c21607 udev-shim: Harden rules file write with retry loop
Handle BrokenPipe and AlreadyExists races when writing default udev
rules during early boot. Retry up to 3 times with 50ms backoff.
2026-05-20 14:00:49 +03:00
vasilito 40ba2caaf6 base: Add missing P35-P43 boot-hardening patches
Graceful init patches for fbcond, graphics scheme, smolnetd, vesad,
PCI interrupt allocation, BAR probing, common init, inputd fallback,
and dhcpd hard dependency ordering.
2026-05-20 13:57:47 +03:00
vasilito 8f8c69a04e docs: Remove named AI references from commit policy
Make the anti-pattern description generic instead of naming a
specific tool or service.
2026-05-20 13:55:53 +03:00
vasilito ae46dabeb0 docs: Add comprehensive system assessment and improvement plan
Replace 5 stale planning docs with unified assessment:
- New: COMPREHENSIVE-SYSTEM-ASSESSMENT-AND-IMPROVEMENT-PLAN.md
  (12-subsystem audit vs Linux 7.1, 6 phases of work)
- Removed: IMPLEMENTATION-MASTER-PLAN, SUBSYSTEM-ASSESSMENT-2026-05,
  SMP-BOOT-HARDENING-PLAN, CPU-DMA-IRQ-MSI-SCHEDULER-FIX-PLAN,
  COMPREHENSIVE-BOOT-IMPROVEMENT-PLAN
2026-05-20 13:47:25 +03:00
vasilito b1af8a356f acpid: Add ACPI thermal zone discovery and evaluation (P44)
Implement full thermal zone backend in acpid:
- thermal.rs: Discover \_TZ_.TZ* zones, evaluate \_TMP, \_CRT, \_PSV,
  \_AC0, \_TC1, \_TC2, \_TSP, \_TZP methods
- scheme.rs: Expose /scheme/acpi/thermal/ with per-zone temperature files
- acpi.rs: Add thermal_state and thermal_zone_names() to AcpiContext

Wired as P44 patch in base recipe.toml.
2026-05-20 13:47:04 +03:00
vasilito 6ca3e47383 Add coretempd CPU temperature sensor daemon
New local recipe coretempd reads IA32_THERM_STATUS MSR via the
new sys:msr scheme and exposes per-CPU temperatures via scheme:coretemp.

- Reads IA32_THERM_STATUS (0x19C) and IA32_TEMPERATURE_TARGET (0x1A2)
- Calculates Celsius from digital readout relative to TjMax
- Exposes /scheme/coretemp/ directory with per-CPU temperature files
- Added to redbear-mini.toml (inherited by redbear-full)
- Added 15_coretempd.service init file
2026-05-20 13:46:43 +03:00
vasilito 7999a896d0 cpufreqd: Use new sys:msr scheme for P-state control
Replace non-existent /dev/cpu/{n}/msr path with /scheme/sys/msr/{cpu}/{msr}
now that the kernel exposes MSR access via the sys scheme.
2026-05-20 13:40:45 +03:00
vasilito 56be23ce6e kernel: Add sys:msr scheme for userspace MSR read/write
Expose MSR access via /scheme/sys/msr/<cpu>/<msr> for root only.
Required for cpufreqd P-state control and thermal sensor drivers.
2026-05-20 13:38:53 +03:00