Files
RedBear-OS/local/docs/REDBEAR-FULL-SDDM-BRINGUP.md
T
vasilito 1dd1fccbf3 docs: relocate DRIVER-MANAGER-MIGRATION-PLAN to archive + cleanup
The DRIVER-MANAGER-MIGRATION-PLAN was self-declared complete (the
driver-manager cutover happened 2026-07-23 per local/AGENTS.md). It
is now historical reference material rather than current planning
authority. Move it from local/docs/ into the established
legacy-obsolete-2026-07-25/ archive directory, updating every
inbound reference.

Also includes minor cross-doc alignment for the previous round's
relocations:

- local/AGENTS.md: update DRIVER-MANAGER-MIGRATION-PLAN to point to
  the legacy archive
- local/docs/REDBEAR-FULL-SDDM-BRINGUP.md: alignment update
- local/docs/CONSOLE-TO-KDE-DESKTOP-PLAN.md: alignment update
- local/docs/archived/README.md: refresh archive contents note
- local/recipes/system/redbear-driver-policy/source/policy/README.md:
  policy doc drift alignment
- local/scripts/guard-recipes.sh: fix symlink target computation
  (relative path was being glued onto an absolute path, producing
  malformed dangling links like '../..//mnt/.../recipe.toml')
  -- this is a real bug fix discovered during this audit round.
2026-07-27 12:05:54 +09:00

178 lines
12 KiB
Markdown

# redbear-full → SDDM Wayland greeter: bring-up campaign
**Goal:** make `redbear-full` compile and wire every component so a run shows the
**SDDM Wayland login prompt**, on either **VirGL** (QEMU virtio-gpu) or **Intel**.
**Runtime chain:** `redox-drm``/scheme/drm/card0` → Mesa (GBM/EGL/llvmpipe) →
KWin (Wayland, `KWIN_DRM_DEVICES=/scheme/drm/card0`) → SDDM greeter (Qt6/Wayland).
Greeter service = `21_sddm.service`; seat = `seatd`.
Grounded in four investigations (2026-07-24): Mesa port, DRM provider, build
efficiency, upstream forks. Key correction to stale memory: the Mesa EGL/DRI
`with_dri` gate is already solved in-tree (redox added to `system_has_kms_drm`);
the frontier has moved to Qt6-on-Wayland (see `QT6-WAYLAND-NULL8-DIAGNOSIS.md`).
## 2026-07-25 MILESTONE — entire SDDM greeter stack builds on Redox
Every greeter-critical component now compiles and produces a pkgar:
`qtbase qtshadertools qtdeclarative qtsvg qtwayland` (Qt 6.11.1), `mesa`,
`redox-drm`, the 9 kf6 core frameworks sddm needs, **`sddm`**,
**`redbear-compositor`**, **`redbear-greeter`**. (The greeter runs on
redbear-compositor, NOT KWin — KWin is post-login and deferred.)
**Sole remaining ISO blocker (2026-07-25 snapshot): `driver-manager`** — at
the time of this milestone it failed with `Arc does not implement Copy`
(main.rs:390) because it compiled against the operator's in-progress
**redox-driver-sys** (`unified_events`/`redox_driver_core`, dirty working
tree). It is boot-critical (spawns redox-drm → `/scheme/drm/card0` for the
display) so cannot be excluded.
> **STATUS UPDATE (2026-07-26): RESOLVED.** The `Arc`/`Copy` move-bug was fixed
> (commits `2a65fb760d`, `4822c85e5c` — clone `Arc` for the listener closures)
> and the driver-manager cutover completed (operator-ratified, 2026-07-23/24):
> `driver-manager` is the sole PCI match/claim/spawn daemon in every
> `redbear-*` config and compiles cleanly. `pcid-spawner` is fully retired.
> See `local/docs/DRIVER-MANAGER.md` (current-state consolidated doc). The ISO now
> assembles via `make live`; the open work is **runtime display validation in
> QEMU** (seeing the SDDM/greeter prompt on the framebuffer), not compilation.
**Post-login desktop deferred** (kwin/plasma/kirigami/konsole/kf6-ksvg/… — 42
packages outside the greeter closure) via `# GREETER-DEFER` comments in
`config/redbear-full.toml`. Re-enable for the full Plasma desktop by
uncommenting them (`sed -i 's/^# GREETER-DEFER: //' config/redbear-full.toml`)
and restoring `kwin` to the pre-cook list.
Key Redox ports this campaign: Qt sysroot resolution (qml symlink + plugins
dual-stage helper), sddm VirtualTerminal + utmpx stubs, kf6-solid QSystemSemaphore
guard, kf6-kwindowsystem Wayland-plugin disable, mesa patch-path linking, stale
6.11.0 source.tar purge. See git log + [[qt-redox-build-iteration-gotchas]].
> **Round 5 update (per `local/docs/3D-DRIVER-PLAN.md` §12):** The SDDM
> `wayland-patch.sh` was rewritten. The prior sed-stub approach for XAuth.cpp
> was replaced with a real `XAuth` implementation that reads / writes the
> `.Xauthority` file using the standard X11 on-disk format via relibc's
> `<X11/Xauth.h>` (added in Round 1). Only the XorgDisplayServer /
> XorgUserDisplayServer classes remain stubbed (no real X server in this
> build). The current `recipes/kde/sddm/wayland-patch.sh` is a real Wayland-only
> port, not a sed hack.
## Component homes
- `redox-drm` (DRM provider, `/scheme/drm/card0`): `local/recipes/gpu/redox-drm/` — cargo. Built-in AMD+Intel+VirtIO KMS drivers; ioctl ABI matches KWin + redbear-compositor.
- `mesa` (EGL/GBM/llvmpipe): `local/recipes/libs/mesa/` (26.1.4) + `local/patches/mesa/`.
- Qt6: `local/recipes/qt/{qtbase,qtdeclarative,qtwayland}` + `local/patches/qtbase/`.
- KF6/KWin/SDDM: `local/recipes/kde/`.
- Compositor: `local/recipes/wayland/redbear-compositor/` — cargo.
- Config: `config/redbear-full.toml`; driver match table `local/config/drivers.d/30-graphics.toml`.
## Phase status
| Phase | Item | Status |
|---|---|---|
| 0 | **Build system:** stop llvm21/toolchain re-cook on every relibc/base bump (`TOOLCHAIN_PRESERVE` + `REDBEAR_FORCE_TOOLCHAIN_RECOOK` escape) | **DONE** `f6b09ff7` |
| 1a | **Mesa EGL gate persisted** as tracked patch `08-meson-redox-kms-drm.patch` (was untracked in-place edit, lost on re-extract) | **DONE** `74d5e01b` |
| 1b | Mesa build — clear next blockers (libdrm dep now required; GBM backend; wayland-scanner: patch 07 is stale vs 26.1.4 layout, recipe uses `$WAYLAND_SCANNER` env — verify) | **TODO** (needs cook) |
| 2 | **VirGL determinism:** redox-drm wins virtio-gpu bind (priority-61 vendor 0x1AF4) so KWin gets a real `card0` instead of virtio-gpud's VT scanout | **DONE** `a00c13e5` |
| R | Rust components compile-verified: `redox-drm` ✓, `redbear-compositor` ✓ (x86_64-redox) | **DONE** |
| 3 | Full build campaign: mesa → libdrm → qt6 → kf6 → kwin → sddm; fix each compile failure | **TODO** (needs cook) |
| 4 | Qt6 Wayland `null+8`: comprehensive null guards committed in qtwaylandscanner (init_listener wrap) and libwayland (all `wl_proxy_*` entry points) per README + `local/docs/DRIVER-MANAGER.md` (post-v5.6); **runtime not yet validated** in isolation (root cause of why the proxy is ever NULL still open — see `QT6-WAYLAND-NULL8-DIAGNOSIS.md` §7 runbook) | **GUARDS COMMITTED, RUNTIME OPEN** |
| 5 | Boot redbear-full (QEMU virtio-gpu, `-m 4G`) → observe SDDM greeter on framebuffer | **TODO** |
## Upstream cherry-pick candidates (enabling, not required yet)
From the upstream-forks sweep — fetch + cherry-pick only if we hit these runtime bugs (they touch operator-active kernel/relibc, so coordinate):
- kernel `eaf50894..486a7818`: **futex-on-shared-memory CoW fix** (Mesa/Wayland shared buffers), poll-hang, read_with_timeout.
- relibc `9867c155..707169e2`: **ld.so lazy PLT relocation** (dlopen of libEGL/libgbm), poll/epoll timeout, UDS-connect outside rootfs.
- base `59cf8189..488da6a1`: ramfs hosting AF_UNIX sockets (Wayland `$XDG_RUNTIME_DIR/wayland-0`).
## Runtime wiring audit (config/redbear-full.toml)
**Greeter compositor:** `/etc/sddm.conf` sets `[Wayland] CompositorCommand=/usr/bin/redbear-compositor`.
So the SDDM greeter renders on **redbear-compositor** (KWin is the post-login
session compositor). Rendering the greeter does NOT need the compositor input
wiring (that only gates typing a login) — so "see the SDDM prompt" is reachable
without the input refactor.
**Runtime chain (coherent):** `00_driver-manager` sees the GPU PCI device →
spawns `redox-drm` (priority-61 for virtio/Intel/AMD) → `/scheme/drm/card0`
`21_sddm` (`REDBEAR_DRM_WAIT_SECONDS=30` waits for card0) → launches
`redbear-compositor` → SDDM greeter Qt/Wayland UI. Needs `dbus`, `seatd`,
`redbear-sessiond`, `redbear-authd` (all `requires_weak` on sddm).
**CONFLICT — RESOLVED (`9f528397`, operator: "SDDM is the only greeter"):** three
display entry points fired as `oneshot_async`, each contending for the
single-owner GPU/card0/VT: `20_display` (redbear-session-launch KDE session),
`20_greeter` (redbear-greeterd), `21_sddm` (target). The first two are now gated
off reversibly via `condition_path_exists = ["/etc/redbear/enable-legacy-greeter"]`
(sentinel not installed; `touch` it to re-enable). `21_sddm` runs ungated.
Post-login session launch is SDDM's job (`SessionDir=/usr/share/wayland-sessions`
— note: no session `.desktop` is defined there yet; that's a post-prompt task).
## Build notes / deficiencies fixed
- Full builds re-cooked llvm21 (~1-2h) on every base/relibc bump — fixed in Phase 0.
- Mesa source/ is an untracked build artifact; durable Mesa changes MUST be patches (Phase 1a).
- More build-system deficiencies expected during the cook campaign — fix comprehensively as found.
## Build campaign log
### Round 1 (2026-07-24) — redox-driver-sys `Once` regression (sole blocker)
- `redbear-full --upstream` launched. llvm21 precook OK (long pole done).
- **SOLE compile failure: `redox-driver-sys`** fails for x86_64-redox with E0425
"cannot find type Once" (`pci.rs:20`) — a regression from operator commit
`d945483915` (added a Redox-only IOPL `Once` guard without importing it). It is
a foundational dep (via `linux-kpi`) of mesa, redox-drm, and every driver, so it
cascaded across the whole driver/graphics layer (mesa never reached EGL config).
- **Fixed:** cfg-gated `use std::sync::Once;` (commit on redox-driver-sys source).
- Desktop stack (Qt6/KF6/KWin/SDDM) does NOT depend on redox-driver-sys → caches
fine in the doomed round. Plan: let round 1 cache the desktop stack, then
restart incrementally with the fix so the driver/graphics layer cooks correctly.
- **Next:** on restart, watch mesa (first real EGL-gate validation) + redox-drm.
### Round 2 (2026-07-24) — mesa Redox port + full-ISO wiring
- **EGL gate validated**: mesa configured (with_dri→egl/gbm) and compiled — the
historical hard blocker is cleared. Two C-level Redox port gaps fixed, in order:
1. `alloca` not declared (shader_query.cpp + others): force-include `alloca.h`
via recipe meson c_args/cpp_args (relibc provides `#define alloca __builtin_alloca`).
2. wayland-scanner exit 127: meson resolved the TARGET (Redox) wayland-scanner
from wayland-scanner.pc (can't run on host); recipe now overwrites the sysroot
copy with the host wayland-scanner before meson (protocol codegen is portable).
- **Full-ISO wiring fixed to reach SDDM** (assessment + fixes):
- VirGL: added priority-61 redox-drm 0x1AF4 entry to the INSTALLED inline
30-graphics.toml in config/redbear-full.toml (local/config/ copy was NOT shipped).
- redbear-compositor: create_dir_all(XDG_RUNTIME_DIR) before Wayland socket bind.
- redbear-iwlwifi excluded from redbear-meta deps (operator-authorized, temporary)
so `make live` assembles.
- SDDM-only greeter: 20_greeter/20_display gated off (earlier).
- **Next:** mesa.pkgar → cook redox-drm/qt/kwin/sddm → assemble ISO
(REDBEAR_SKIP_ABI_STALENESS=1 build-redbear.sh --upstream redbear-full) → boot
QEMU virtio-gpu → SDDM prompt.
### Round 3 (2026-07-24) — MESA BUILDS ON REDOX ✅
mesa.pkgar produced (27MB); libEGL.so + libgbm.so staged. The historical hard
blocker (Mesa EGL/DRI on Redox) is CLEARED. Five Redox port fixes total, all in
the tracked recipe (durable):
1. EGL gate: `redox` in meson system_has_kms_drm (patch 08).
2. alloca: force-include alloca.h.
3. wayland-scanner: overwrite sysroot copy with host binary (exit 127).
4. CLOCK_MONOTONIC_RAW: relibc has none, and Redox CLOCK_MONOTONIC=4 (not
Linux 1) — collided. Fixed by disabling Vulkan swrast (greeter uses GL, not
Vulkan; Vulkan WSI was the only consumer) + collision-proof define.
Next: full build assembles the ISO (mesa cached, + driver-manager [operator WIP]
+ redox-drm/qt/kwin/sddm) → boot QEMU virtio-gpu → SDDM prompt.
### Round 4 (2026-07-24) — Qt 6.11.1 upgrade + durability correction
- **Durability correction:** diffed committed qtbase source vs pristine 6.11.0 →
BYTE-IDENTICAL (0 changed files). qtbase has NO in-place fixes; it simply never
built before (no pkgar). Its Redox fixes are all in redox.patch (durable). The
earlier "lost in-place fixes" alarm was a MISDIAGNOSIS — re-fetching 6.11.1 is
safe. All session porting fixes go into durable patches in local/.
- **Qt version:** recipes are tar=6.11.1 (operator intent); committed source was
stale 6.11.0 (never re-fetched after the bump). Correct path = 6.11.1 for all
modules + fixes as patches. Re-fetching 6.11.1 (safe, verified).
- **Durable patches so far:** mesa (5 fixes, recipe+patch08), qtbase
redox-in6-pktinfo.patch (recipe dir), qtsvg CVE patch reference fixed.
- **Next 6.11.1 gap:** forkfd_wait4 conflicting types (a 6.11.1 header change vs
6.11.0; forkfd.c itself identical) — to fix as a durable patch.
- **Build-system deficiency noted:** Qt source is committed in-tree (22k files/mod)
yet re-fetch overwrites it — the durable truth should be recipe(tar+blake3)+patches,
source gitignored. Flagged for operator (repo restructure).
- **ISO blocker (not mine):** operator's driver-manager/redox-driver-sys WIP.