Commit Graph

1506 Commits

Author SHA1 Message Date
vasilito 3c2a4801ac submodules: sync base pointer for unimplemented! stub cleanup 2026-07-10 22:35:03 +03:00
vasilito cbcf992dc9 submodules: sync kernel pointer for EmulateArch::invalidate fix 2026-07-10 22:32:37 +03:00
vasilito f91cb8716a build-redbear: comprehensive build-system improvements 1+3+4+5+6+7+8
Implements 7 of 8 improvements from local/docs/BUILD-SYSTEM-IMPROVEMENT-PROPOSAL.md:

Improvement 1+5: trap-based stash-and-restore for ALL 9 fork sources
  - Replaces single-relibc stash with a loop over the canonical fork
    inventory (relibc, kernel, base, bootloader, installer, redoxfs,
    libredox, syscall, userutils)
  - Records each stash SHA in a label-keyed map for safe round-tripping
  - Pop stashes in LIFO order matching user-visible stash pop convention
  - Idempotent: re-entry during the same build does not double-stash
  - Reports (does not silently swallow) real git errors during stash push
  - Restored on EXIT regardless of success/failure/signal

Improvement 3: cookbook binary freshness check
  - Replaces existence-only check with BLAKE3-of-src/.rs fingerprint
  - Hash written to target/release/.cookbook-src-fingerprint
  - Rebuild triggers on any source file content change, not just mtime
  - Survives git operations that change content without touching mtime

Improvement 4: strict-by-default uncommitted-edit gate
  - Refuses to build with uncommitted edits in any fork source
  - Catches the 'works on my machine' bug class where pkgar fingerprints
    silently mismatch the committed HEAD
  - Escape hatch: REDBEAR_ALLOW_DIRTY=1 for emergency CI use
  - apply-durable-source-edits.py auto-enables strict mode when
    REDBEAR_BUILD_PHASE is set (set by build-redbear.sh)

Improvement 6: failure-cleanup trap with diagnostics
  - EXIT trap captures last 30 lines of each cookbook log
  - Lists orphaned cook/cargo processes (often root cause of follow-on
    build failures via held locks)
  - Reports per-recipe build state (complete vs incomplete)
  - Preserves diagnostics in REDBEAR_BUILD_STATE_DIR (mktemp -d)
  - REDBEAR_KEEP_BUILD_STATE=1 retains the state dir after exit

Improvement 7: pre-cook offline/upstream consistency
  - Pre-cook now follows the same offline policy as the main build phase
  - REDBEAR_ALLOW_UPSTREAM=1 → offline=false
  - default / REDBEAR_RELEASE → offline=true
  - Pre-cook logs captured into REDBEAR_BUILD_LOGS_DIR for diagnostics
  - Sets REDBEAR_BUILD_PHASE=pre-cook so downstream code can distinguish

Improvement 8: cookbook protection against out-of-band invocations
  - src/bin/repo.rs emits a warning when invoked without
    REDBEAR_CANONICAL_BUILD=1 in the environment
  - The warning lists what is bypassed (cache invalidation, prefix
    rebuild, fingerprint tracking, dirty gate)
  - Non-fatal: CI scripts that manage their own checks are unaffected

Smoke-tested: ./local/scripts/build-redbear.sh redbear-mini now exits 1
when relibc/kernel have uncommitted edits, and proceeds when
REDBEAR_ALLOW_DIRTY=1 is set.
2026-07-10 22:10:33 +03:00
vasilito 6b2f54c9bd docs: add canonical build system improvement proposal
Documents 8 concrete improvements to build-redbear.sh and the cookbook
tool, derived from the redbear-mini boot crash debug session:

1. Trap-based stash-and-restore for ALL fork sources (eliminates the
   'where did my edits go?' pain)
2. Source content-hashing to replace mtime-only cache invalidation
3. Cookbook binary freshness check (currently existence-only)
4. Strict-by-default uncommitted-edit gate
5. Stash-all-forks consistency
6. Failure-cleanup trap with diagnostics
7. Pre-cook offline/upstream consistency
8. Cookbook protection against out-of-band invocations

Each improvement has a file:line location, implementation sketch,
and impact/complexity rating. Implementation order suggested.

Problem motivation: the user has repeatedly hit silent stash-loss,
stale cookbook binaries, and mtime-based cache staleness while
debugging kernel/relibc/base forks. The build pipeline should
make these mistakes impossible, not require users to remember
workarounds.
2026-07-10 21:57:46 +03:00
vasilito 7c2ea9b5e3 amdgpu/linux-kpi: replace remaining stubs with real implementations
- Implement krealloc in linux-kpi memory.rs with GFP-aware tracker lookup,
  copying, and zeroing of grown regions; add krealloc declaration to slab.h
- Align __GFP_ZERO/__GFP_NOWARN and GFP_* values between linux-kpi/slab.h
  and redox_glue.h; make __GFP_ZERO a meaningful flag bit
- Add missing POSIX/errno base constants (EFBIG, EISDIR, ESPIPE, etc.) to
  linux-kpi linux/errno.h so firmware-size checks and other drivers compile
- Harden linux-kpi bug.h: BUG()/BUG_ON() abort, WARN_ON_ONCE only warns once,
  BUILD_BUG_ON uses _Static_assert
- Harden redox_glue.h: add PCI_COMMAND_* flags, CONFIG_HZ/HZ, jiffies
  conversion macros, once-only WARN_ON_ONCE, _Static_assert BUILD_BUG_ON
- Implement redox_pci_enable_device/redox_pci_set_master with real local state
  and command-bit updates; document pcid-spawner pre-enable
- Remove realloc-only krealloc from redox_stubs.c; it now links from linux-kpi
- Fix wait_for_completion_timeout to interpret timeout as jiffies and convert
  to milliseconds, and update msecs/usecs_to_jiffies to use HZ
- Stage previously completed firmware-loader path deps and constructor fix
- Stage base and relibc submodule pointer updates from prior work
2026-07-10 19:44:39 +03:00
vasilito 705d15ec1f kf6-kcmutils: update local fork to 6.27.0 and restore QML/Quick/kcmshell
The tracked source tree was stuck at KF6 6.10.0 with QML/Quick/kcmshell
stripped out and kcmoduleloader/kcmultidialog gutted by sed/python hacks.

Replace the local source with the upstream 6.27.0 tarball content, keeping
only the .clang-format and docs/ extras. This restores:
- add_subdirectory(qml) / (quick) / (kcmshell)
- kcmoduleqml.cpp/h, KF6KCMUtilsQuick, Qt6::Qml/Quick/QuickWidgets links
- kcmoduleloader.cpp and kcmultidialog.cpp QML code paths
- ECMQmlModule and KF6KIO find_package in top-level CMakeLists.txt
- Qt6Qml find_dependency in KF6KCMUtilsConfig.cmake.in

Shrink the recipe build script to use cookbook_apply_patches of the
external 01-initial-migration.patch and remove all sed/python hacks.
Shrink the migration patch to only disable ki18n_install(po) (translations
remain deferred until lupdate/lrelease is built for target).
2026-07-10 17:11:44 +03:00
vasilito 66e48ff274 submodules: sync kernel pointer for syscall/process.rs import fix 2026-07-10 17:01:16 +03:00
vasilito 8ba00f2880 firmware-loader: use path dependencies for redox forks
Replace version-string deps on redox_syscall, redox-scheme, and
libredox with path dependencies pointing to local/sources/ forks.
This aligns with local/AGENTS.md local-fork-dependency rule and
eliminates the crates.io vs local fork ambiguity that causes
mismatched-type link errors.
2026-07-10 16:27:29 +03:00
vasilito 636b88878e redox-drm: advertise PRIME, accept atomic/universal-plane caps, virgl format bpp
- get_capability: advertise DRM_CAP_PRIME (capability 2) as supported
- DRM_IOCTL_SET_CLIENT_CAP: accept UNIVERSAL_PLANES (2) and ATOMIC (3)
- Track bytes-per-pixel per virgl resource handle for transfer stride
- Decode blob_mem lower bits from virgl_resource_create flags

These improve virtio-gpu / virgl Mesa compatibility for the
software-rendered desktop path.
2026-07-10 16:27:27 +03:00
vasilito d22eb3dd9d submodules: sync base, kernel, relibc, syscall pointers
Pushes latest Red Bear commits on each submodule branch:
- base: acpid EC, inputd, block driver, ipcd UDS, loopback, ptyd, ramfs, randd
- kernel: SYS_MKNS/SYS_SETNS namespace syscalls, offset normalization fixes
- relibc: byteswap.h, sys/statfs, ioccom.h, MAP*/MSG*/TIOCM/CRTSCTS, statfs/cbindgen cleanup
- syscall: SYS_SETNS syscall number

These commits were already on local submodule working trees; this
updates the parent repo pointers to match.
2026-07-10 16:27:24 +03:00
vasilito 796c7ee85a wireplumber: remove redundant byteswap.h and sys/mman.h shims
relibc now provides the real <byteswap.h> header and Linux mmap
extension flags (MAP_LOCKED, MAP_HUGETLB, etc.) in <sys/mman.h>.
Drop the redox_compat/ shim files from the WirePlumber patch, update
README-redbear.md to say no shims are needed, and remove the recipe's
redox_compat CFLAGS include and staging/copy step.
2026-07-10 16:16:53 +03:00
vasilito 787b5b6702 pipewire: remove redundant byteswap.h and sys/mman.h shims
relibc now provides the real <byteswap.h> header and Linux mmap
extension flags (MAP_LOCKED, MAP_HUGETLB, etc.) in <sys/mman.h>.
Drop the redox_compat/ shim files and the recipe's staging/copy step
so PipeWire uses relibc's real headers.

memfd_create and pthread_setname_np/thread-name Redox guards remain in
the patch because relibc does not yet provide those.
2026-07-10 16:10:55 +03:00
vasilito f3269b414c docs: add LOCAL-FORK-SUPREMACY-POLICY
Documents the project-wide rule that Red Bear OS local forks are the
complete, authoritative source of truth for every component they cover.

Key points:
- A fork that delegates to upstream/crates.io is not a fork — it's a wrapper.
- Missing fork functionality is implemented in the fork, not papered over.
- Path deps + [patch.crates-io] everywhere; no version strings for forks.
- Adapt to upstream at the same pace — never pin back.

Adds a cross-reference from local/AGENTS.md DESIGN PRINCIPLE section.
2026-07-10 16:08:50 +03:00
vasilito 7b6e83f14b kf6-kjobwidgets: restore KNotificationJobUiDelegate and KF6Notifications
Re-enable the desktop notification delegate that was disabled in the
initial migration patch. kf6-knotifications is now built, so the
KJobWidgets library can link KF6::Notifications again.

- Remove duplicated Qt6GuiPrivate find_package lines from CMakeLists.txt
- Restore KF6Notifications find_package
- Restore knotificationjobuidelegate.cpp/h in src/CMakeLists.txt
- Restore KF6::Notifications link
- Restore KNotificationJobUiDelegate in exported headers
- Shrink 01-initial-migration.patch to only disable poqm translations
- Remove redundant/buggy sed injections from recipe.toml

The recipe.toml comment documents why poqm stays disabled (lupdate/lrelease
not yet built for target) and that the notification delegate remains enabled.
2026-07-10 16:06:02 +03:00
vasilito ef89473695 amdgpu: vmalloc/vfree use mmap with guard pages
vmalloc now allocates with PROT_NONE guard pages on each side,
matching Linux kernel vmalloc behavior. Buffers overflow into a
guard page and segfault instead of silently corrupting adjacent
heap allocations.
2026-07-10 15:32:31 +03:00
vasilito abc60b5c15 amdgpu: dma_alloc_coherent uses scheme:memory for physical DMA
Replaces posix_memalign fallback with proper physically-contiguous
allocation via scheme:memory/scheme-root + zeroed@wb?phys_contiguous.
Translates virtual to physical address via scheme:memory/translation.

Falls back to heap allocation if scheme:memory is unavailable.

Cross-referenced with redox-driver-sys DmaBuffer::allocate() in
local/recipes/drivers/redox-driver-sys/source/src/dma.rs.
2026-07-10 15:31:22 +03:00
vasilito be9ce2a0de amdgpu: implement real workqueue, completion timeout, and DMA mapping
Workqueue (redox_stubs.c + redox_glue.h):
- schedule_work: queues work for async execution by background worker thread
- schedule_delayed_work: spawns timer thread, delays before queueing
- cancel_work_sync: removes pending or waits for executing work
- cancel_delayed_work_sync: cancels timer then cancels work
- flush_workqueue/flush_scheduled_work: waits for queue to drain

Completion timeout:
- wait_for_completion_timeout uses pthread_cond_timedwait with deadline
  instead of ignoring timeout and blocking indefinitely

DMA mapping:
- dma_map_page returns page address+offset instead of bogus 0

Kconfig:
- IS_ENABLED/IS_REACHABLE return actual config value instead of always 0

Cross-referenced with Linux 7.1 kernel/workqueue.c and
include/uapi/linux/kernel.h.
2026-07-10 15:28:55 +03:00
vasilito 91e8e55505 KF6/KDE: replace per-recipe poqm/ki18n_install sed hacks with global cmake flag
Replaced 42 fragile per-recipe sed hacks (commenting out
ecm_install_po_files_as_qm and ki18n_install(po) in CMakeLists.txt)
with a single clean cmake flag: -DKF_SKIP_PO_PROCESSING=ON.

Both ECMPoQmTools.cmake and KF6I18nMacros.cmake.in natively check
KF_SKIP_PO_PROCESSING and return early before reaching
find_package(Qt6 COMPONENTS LinguistTools CONFIG REQUIRED).

This eliminates the need for Qt6LinguistTools (lupdate/lrelease)
at build time. When qttools is eventually built and Qt6LinguistTools
becomes available, simply remove the flag to re-enable translations.
2026-07-10 14:37:04 +03:00
vasilito 65547eba1d relibc submodule: add CRTSCTS + TIOCM serial constants for Redox 2026-07-10 14:26:27 +03:00
vasilito 4685a5deed redbear-power: parse Ngid and TracerPid procfs fields instead of ignoring
Adds ngid and tracer_pid fields to ProcStatus struct. These were
previously silently discarded during /proc/<pid>/status parsing.
2026-07-10 14:20:03 +03:00
vasilito ed4bf520f6 relibc submodule: add ioccom.h, byteswap.h, statfs, MAP_* and MSG_* constants
Updates relibc submodule pointer to include:
- sys/ioccom.h, byteswap.h, sys/statfs.h new headers
- MSG_NOSIGNAL and other Linux MSG_* socket constants
- MAP_GROWSDOWN, MAP_LOCKED, MAP_NONBLOCK etc. mman constants
- ELFMAG/SELFMAG defines in generated elf.h
2026-07-10 14:15:34 +03:00
vasilito a71b7f8baa compositor+evdevd: eliminate remaining disguised stubs
Compositor:
- XDG_POPUP_GRAB: read serial from payload (was generating fake serial)
- XDG_POPUP_REPOSITION: fix payload parsing, look up positioner state,
  send configure+repositioned events with correct token
- WL_SUBSURFACE_PLACE_ABOVE/BELOW: implement z_index tracking for
  real subsurface stacking order
- Unknown global bind: log warning instead of silent type-0 assignment
- DRM page flip: log ioctl errors instead of silently ignoring
- handlers.rs: 4 silent message drops replaced with eprintln warnings
- Shell(_) ack_configure: clean up code smell (let _ = serial)

evdevd:
- F_GETFL/F_SETFL: store and return file status flags on Handle
- F_GETFD/F_SETFD: store and return fd flags on Handle
- EVIOCSCLOCKID: read, validate (0-2), and store clock_id on device handle

relibc submodule pointer update (dso.rs catch-alls → log+skip).
2026-07-10 13:47:09 +03:00
vasilito bc5121e971 kernel: bump submodule for proc scheme u64::MAX offset fix 2026-07-10 13:43:07 +03:00
vasilito aee3843012 relibc submodule: implement utimensat() 2026-07-10 12:14:56 +03:00
vasilito 2d96b44eb7 relibc submodule: exclude cpu_set_t duplicate 2026-07-10 11:52:56 +03:00
vasilito dd138e4f50 relibc submodule: fix cpu_set_t header ordering 2026-07-10 11:47:22 +03:00
vasilito 4bbb7e41e1 bison: add sched.h cache variables for gnulib cross-compile
Gnulib generates lib/sched.h which wraps the system sched.h via
#include_next, but the #if @HAVE_SCHED_H@ guard evaluates to 0 during
cross-compilation, preventing sched_param typedef from being visible.
Adding ac_cv_header_sched_h=yes fixes the guard.
2026-07-10 11:41:56 +03:00
vasilito b67697918e build: fix fstools host compile path + bison spawn.h cross-compile
fstools.mk: Use canonical local/sources/ paths for installer and redoxfs
cargo install --path. The recipes/ symlink chain caused cargo to resolve
path dependencies (../libredox, ../redoxfs, ../syscall) relative to the
recipe directory instead of the canonical source location, breaking
the host build.

bison: Add cross-compilation cache variables for POSIX spawn support.
Gnulib's configure couldn't detect the system spawn.h during cross-compile,
causing generated lib/spawn.h to omit #include_next, leaving
POSIX_SPAWN_* constants undefined.
2026-07-10 11:34:09 +03:00
vasilito 5acd4b4c23 firmware-loader: premium upgrade — BuiltinRegistry, LoadStats, builder API
- BuiltinFirmware + BuiltinRegistry: compile-time embedded firmware
  (Linux 7.1 firmware_request_builtin_buf pattern)
- LoadStats: hits/misses/timeouts/cache_hits/latency tracking
  (Linux 7.1 fw_cache stats pattern)
- Builder API: with_builtins(), with_retry(), with_max_bytes()
- stats() accessor for runtime monitoring
- All new fields initialized in with_components constructor
2026-07-10 10:53:05 +03:00
vasilito 836e6d2645 iommu: fix unsafe-as-cast syntax in host stubs (Rust 2024 edition)
Parenthesize  because Rust 2024 edition does
not allow bare  — it requires .
Affected geteuid/getuid/getegid/getgid host stubs.
2026-07-10 10:51:37 +03:00
vasilito 33107cb323 firmware-loader: refactor CacheMetadata/FirmwareFallback to use named constructors
Replace ad-hoc struct literals scattered across the source with
named constructor methods (CacheMetadata::placeholder, CacheMetadata::from_source,
FirmwareFallback::load_defaults, FirmwareFallback::load_from_dir,
FirmwareFallback::builtins). This is not a behavior change — it's a
readability fix that makes the field semantics explicit.

Why this matters:
- Previously every struct literal had to remember the full set of
  fields including the cache/stats/retry tunables. Adding a new field
  required finding every literal in the source tree.
- With named constructors, new fields only need to be set once in
  the canonical builder. Test/placeholder sites stay minimal.
- Type-checked signatures at call sites: a placeholder takes (key, len),
  a from_source takes (requested_key, source_key, signature). The
  compiler now verifies you pass a SourceSignature when you need one.

Cross-referenced with Linux drivers/base/firmware_loader.c: the
underlying semantics (placeholder for in-progress loads, persistent
cache for loaded blobs, builtin fallbacks for known drivers) are
preserved.
2026-07-10 10:32:32 +03:00
vasilito 649e7a8776 restore forward fixes: relibc CPU_* macros + fenv, kernel OOM fix 2026-07-10 10:25:54 +03:00
vasilito a838b3be13 iommu: fix unsafe-as-cast syntax in host stubs (Rust 2024 requires parenthesized cast) 2026-07-10 10:19:49 +03:00
vasilito fe9a77716e relibc: revert to known-good state (9387fd2c) for boot testing 2026-07-10 10:18:37 +03:00
vasilito e00f0d7817 firmware-loader: premium upgrade — builtins, stats, retry, limits (Linux 7.1 port)
Additions cross-referenced with Linux 7.1 drivers/base/firmware_loader/:

- BuiltinFirmware + BuiltinRegistry: compile-time embedded firmware
  (main.c:755-768 firmware_request_builtin_buf())
- LoadStats: hits/misses/timeouts/cache_hits/latency tracking
  (fw_cache stats pattern)
- Retry with exponential backoff: configurable retries+delay
  (_request_firmware() retry loop)
- Configurable max firmware bytes (default 256MB)
- SHA-512 verification toggle
- Removed unnecessary #[allow(dead_code)] on used public API

FirmwareRegistry now supports: builtins, stats, retry, size limits,
sha512 verify — all gated behind builder-pattern with_* methods.
2026-07-10 10:17:42 +03:00
vasilito 19de2c96af relibc: add CPU_* macros to sched.h (fixes glib build) 2026-07-10 10:09:11 +03:00
vasilito 7f00133337 iommu: replace 31 host-stub ENOSYS returns with real libc implementations
Previously: host_redox_stubs returned ENOSYS for all syscalls except
close/munmap/get_euid/ruid/egid/rgid — silent failures when IOMMU
code was tested on the host.

Now (host only):
- open/read/write/close → real libc file I/O
- mmap → real libc memory allocation (MAP_ANON|MAP_PRIVATE)
- munmap → real libc munmap
- clock_gettime → real libc CLOCK_REALTIME
- fstat → real libc fstat
- fsync/fdatasync/ftruncate → real libc ops
- getpid/getuid/geteuid/getgid/getegid → real libc
- strerror → real libc strerror (not hardcoded message)
- 12 remaining unsupported ops: ENOSYS with same semantics
  (dup, signals, waitpid, namespaces — not needed for IOMMU tests)
2026-07-10 10:06:37 +03:00
vasilito da71d4883c kernel: revert to stable OOM fix (avoid log crate in 2024 edition) 2026-07-10 09:31:40 +03:00
vasilito ba80213c77 git: bump submodule/kernel — last SharedToCow unreachable fix 2026-07-10 09:25:34 +03:00
vasilito a4b6a129a5 git: bump submodule/kernel — 5 page fault unreachable!()→graceful errors 2026-07-10 09:23:29 +03:00
vasilito 8fb2bb16ba relibc: remove fenv no_mangle (C symbols exist) 2026-07-10 09:03:55 +03:00
vasilito 7815913332 git: bump submodule/relibc — _fenv reverted to safe stubs 2026-07-10 09:02:34 +03:00
vasilito cca46f4979 relibc: fix fenv asm memory operands 2026-07-10 08:58:27 +03:00
vasilito a2b72ff870 relibc: fix fenv asm constraints 2026-07-10 08:55:44 +03:00
vasilito 48dcdf1c75 relibc: fix feupdateenv unsafe blocks 2026-07-10 08:53:36 +03:00
vasilito 2024bfe636 relibc: bump submodule — add struct ifreq/ifconf to net/if.h 2026-07-10 08:39:12 +03:00
vasilito 24a5ae90ea relibc: bump submodule — _fenv with real x86_64 FPU asm 2026-07-10 08:35:43 +03:00
vasilito 2ab3944aa3 kauth: switch back to FAKE backend (polkit-qt6 offline fetch blocked) 2026-07-10 03:52:11 +03:00
vasilito 91f2e510d9 KDE: batch-disable QML+Wayland across 13 recipes (Qt6Qml not built yet) 2026-07-10 03:47:18 +03:00
vasilito 0cdc335e2c kcoreaddons: fix KFileSystemType::Ext4 → Other (Ext4 not in enum) 2026-07-10 03:43:41 +03:00