diff --git a/local/recipes/AGENTS.md b/local/recipes/AGENTS.md new file mode 100644 index 0000000000..5317809370 --- /dev/null +++ b/local/recipes/AGENTS.md @@ -0,0 +1,249 @@ +# Red Bear OS Custom Recipes — Catalog + +All recipes under `local/recipes/` are Red Bear OS originals or patched forks of upstream +Redox recipes. They are symlinked into `recipes//` at build time via +`local/scripts/apply-patches.sh`. + +**Convention**: recipe directories contain `recipe.toml` (build instructions) and optionally +`source/` (source code for Rust `cargo` or `custom` templates). Patches for upstream sources +live in `local/patches//`, never here. + +## archives + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| uutils-tar | cargo | Rust | GNU tar compatible archiver from uutils, for creating and extracting tar archives | + +## branding + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| redbear-release | custom | Shell | OS release metadata: `/etc/os-release`, hostname, and branding assets | + +## core + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| ext4d | custom | Rust | ext4 filesystem driver daemon (userspace, scheme-based) | +| fatd | custom | Rust | FAT32 filesystem driver daemon (userspace, scheme-based) | +| grub | custom | Scripts | GRUB boot manager integration for live ISO and bare-metal installs | +| pcid-spawner | cargo | Rust | PCI device spawner — launches driver daemons on PCI device discovery | + +## dev + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| binutils-native | custom | C | GNU binutils (ld, objdump, etc.) built for native Red Bear target | +| bison | custom | C | GNU bison parser generator | +| cub | custom | Rust | Red Bear build utility — build orchestration helper | +| flex | custom | C | Fast lexical analyzer generator | +| gcc-native | custom | C | GCC cross-compiler for native Red Bear target | +| gnu-make | custom | C | GNU Make build tool | +| libtool | custom | C | GNU libtool — generic library support script | +| llvm-native | custom | C++ | LLVM/Clang toolchain built for native Red Bear target | +| m4 | custom | C | GNU m4 macro processor | +| meson | custom | Python | Meson build system | +| ninja-build | custom | C | Ninja build system (small, fast build runner) | +| rust-native | custom | Rust | Rust toolchain for native Red Bear builds | + +## drivers + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| ehcid | cargo | Rust | EHCI (USB 2.0) host controller driver daemon | +| linux-kpi | custom | C headers | Linux Kernel Programming Interface — C header shim translating Linux kernel APIs to redox-driver-sys. **GPU and Wi-Fi only** — no USB support | +| ohcid | cargo | Rust | OHCI (USB 1.1) host controller driver daemon | +| redbear-btusb | custom | Rust | Bluetooth USB transport driver — sends/receives HCI packets over USB | +| redbear-input-headers | custom | C headers | Linux-compatible input event headers (input.h, evdev constants) for driver and compositor use | +| redbear-iwlwifi | cargo | Rust | Intel Wi-Fi driver (iwlwifi port) — mac80211-based wireless networking | +| redox-driver-acpi | cargo | Rust | ACPI driver — parses RSDP/SDT/MADT/FADT tables, exposes scheme:acpi | +| redox-driver-core | cargo | Rust | Core driver traits and types shared across all redox-driver-* crates | +| redox-driver-pci | cargo | Rust | PCI bus driver — enumerates PCI devices, exposes scheme:pci, provides config space access | +| redox-driver-sys | custom | Rust | Safe Rust FFI wrappers for scheme:memory, scheme:irq, scheme:pci + hardware quirks system | +| uhcid | cargo | Rust | UHCI (USB 1.1) host controller driver daemon | +| usb-core | cargo | Rust | USB core stack — hub driver, device enumeration, transfer scheduling | + +## gpu + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| amdgpu | custom | C | AMD GPU display core (DC) port with linux-kpi compat shim | +| redox-drm | cargo | Rust | DRM/KMS scheme daemon — GPU driver manager, supports virtio-gpu, Intel, AMD. Auto-detects hardware and loads correct driver | + +## groups + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| build-essential-native | custom | Meta | Meta-package group: compiler, linker, make, and core build tools for native development | + +## kde + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| breeze | custom | C++ | KDE Breeze widget style and window decoration theme | +| kde-cli-tools | custom | C++ | KDE command-line utilities (kde-open, kioclient, etc.) | +| kdecoration | custom | C++ | KDE window decoration library — decoration plugin API for KWin | +| kf6-attica | custom | C++ | KDE Frameworks 6 — Open Collaboration Services API (GHNS) | +| kf6-extra-cmake-modules | custom | CMake | KDE Frameworks 6 — Extra CMake Modules (build system extensions) | +| kf6-karchive | custom | C++ | KDE Frameworks 6 — archive handling (tar, zip, etc.) | +| kf6-kauth | custom | C++ | KDE Frameworks 6 — authorization framework (PolicyKit integration) | +| kf6-kbookmarks | custom | C++ | KDE Frameworks 6 — bookmark management (XBEL format) | +| kf6-kcmutils | custom | C++ | KDE Frameworks 6 — KCModule utilities for System Settings | +| kf6-kcodecs | custom | C++ | KDE Frameworks 6 — string encoding/decoding (base64, uuencode, etc.) | +| kf6-kcolorscheme | custom | C++ | KDE Frameworks 6 — color scheme management | +| kf6-kcompletion | custom | C++ | KDE Frameworks 6 — text completion widgets and utilities | +| kf6-kconfig | custom | C++ | KDE Frameworks 6 — configuration file framework (INI, JSON) | +| kf6-kconfigwidgets | custom | C++ | KDE Frameworks 6 — configuration-aware widgets | +| kf6-kcoreaddons | custom | C++ | KDE Frameworks 6 — core utilities (KAboutData, KJob, KProcess) | +| kf6-kcrash | custom | C++ | KDE Frameworks 6 — crash handler with DrKonqi integration | +| kf6-kdbusaddons | custom | C++ | KDE Frameworks 6 — D-Bus convenience classes | +| kf6-kdeclarative | custom | C++ | KDE Frameworks 6 — KDE QtQuick integration plugins | +| kf6-kded6 | custom | C++ | KDE Frameworks 6 — background service daemon (kded6) | +| kf6-kglobalaccel | custom | C++ | KDE Frameworks 6 — global keyboard shortcut registration | +| kf6-kguiaddons | custom | C++ | KDE Frameworks 6 — GUI utilities (color picker, key sequence) | +| kf6-ki18n | custom | C++ | KDE Frameworks 6 — internationalization (gettext integration) | +| kf6-kiconthemes | custom | C++ | KDE Frameworks 6 — icon theme management and rendering | +| kf6-kidletime | custom | C++ | KDE Frameworks 6 — idle time detection for screensaver/power | +| kf6-kio | custom | C++ | KDE Frameworks 6 — I/O framework (KIO slaves for network/FS access) | +| kf6-kitemmodels | custom | C++ | KDE Frameworks 6 — Qt model extensions (KRearrangeColumns, KSortFilter) | +| kf6-kitemviews | custom | C++ | KDE Frameworks 6 — item view widgets (KFilterProxy, KCategoryDrawer) | +| kf6-kjobwidgets | custom | C++ | KDE Frameworks 6 — async job tracking widgets | +| kf6-knewstuff | custom | C++ | KDE Frameworks 6 — Get Hot New Stuff (GHNS) download framework | +| kf6-knotifications | custom | C++ | KDE Frameworks 6 — system notification framework | +| kf6-kpackage | custom | C++ | KDE Frameworks 6 — package/installation framework | +| kf6-kservice | custom | C++ | KDE Frameworks 6 — service/plugin framework (mime type, .desktop parsing) | +| kf6-ksvg | custom | C++ | KDE Frameworks 6 — SVG rendering with theme support | +| kf6-ktextwidgets | custom | C++ | KDE Frameworks 6 — text editing widgets (KTextEdit, find/replace) | +| kf6-kwallet | custom | C++ | KDE Frameworks 6 — secure credential storage | +| kf6-kwayland | custom | C++ | KDE Frameworks 6 — Wayland protocol bindings for Qt/KDE | +| kf6-kwidgetsaddons | custom | C++ | KDE Frameworks 6 — extra Qt widgets (KComboBox, KPageWidget) | +| kf6-kwindowsystem | custom | C++ | KDE Frameworks 6 — window system integration (window info, stacking) | +| kf6-kxmlgui | custom | C++ | KDE Frameworks 6 — XML-defined GUI (menus, toolbars, actions) | +| kf6-notifyconfig | custom | C++ | KDE Frameworks 6 — notification configuration widgets | +| kf6-parts | custom | C++ | KDE Frameworks 6 — embeddable document/viewer parts (KParts) | +| kf6-prison | custom | C++ | KDE Frameworks 6 — barcode/QR code generation (QRencode wrapper) | +| kf6-pty | custom | C++ | KDE Frameworks 6 — pseudoterminal (PTY) management | +| kf6-solid | custom | C++ | KDE Frameworks 6 — hardware abstraction (storage, power, network) | +| kf6-sonnet | custom | C++ | KDE Frameworks 6 — spell checking framework | +| kf6-syntaxhighlighting | custom | C++ | KDE Frameworks 6 — syntax highlighting engine (Kate definitions) | +| kglobalacceld | custom | C++ | KDE global shortcut daemon — handles keyboard shortcut registration | +| kirigami | custom | C++ | KDE Kirigami — responsive QtQuick UI framework (convergent apps) | +| konsole | custom | C++ | KDE Konsole — terminal emulator | +| kwin | custom | C++ | KDE KWin — Wayland compositor and window manager | +| plasma-desktop | custom | C++ | KDE Plasma Desktop — panels, desktop containment, applets | +| plasma-framework | custom | C++ | KDE Plasma Framework — libplasma for Plasma shell and applets | +| plasma-wayland-protocols | custom | C++ | KDE Plasma Wayland protocol extensions | +| plasma-workspace | custom | C++ | KDE Plasma Workspace — plasma-shell, data engines, runners | + +## libs + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| freetype2 | custom | C | FreeType 2 font rendering library | +| glib | custom | C | GLib — core event loop, type system, utility functions | +| icu | custom | C++ | ICU — Unicode and internationalization support | +| lcms2 | custom | C | Little CMS 2 — color management library | +| lcms2-stub | custom | C | Minimal lcms2 stub — provides symbols without implementation | +| libdisplay-info | custom | C | EDID and display descriptor parsing library | +| libdisplay-info-stub | custom | C | Minimal libdisplay-info stub for compile-time satisfaction | +| libdrm | meson | C | libdrm — DRM/KMS user-space library with Red Bear patches for render node and virtio-gpu support | +| libepoxy | custom | C | Epoxy — OpenGL function pointer manager (cross-platform GL loader) | +| libepoxy-stub | custom | C | Minimal libepoxy stub — provides symbols without implementation | +| libevdev | meson | C | libevdev — evdev device wrapper library for input handling | +| libinput | meson | C | libinput — input device management (keyboard, pointer, touch) | +| libqrencode | cmake | C | libqrencode — QR code encoding library | +| libudev-stub | custom | C | Minimal libudev stub — provides symbols for udev-dependent builds | +| libxcvt | custom | C | libxcvt — VESA CVT mode timing calculation | +| libxcvt-stub | custom | C | Minimal libxcvt stub — provides symbols without implementation | +| zbus | custom | Rust | zbus crate — Rust D-Bus message bus library (library-only, custom build) | + +## qt + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| qt6-sensors | custom | C++ | Qt 6 Sensors module — hardware sensor access (accel, gyro, etc.) | +| qtbase | custom | C++ | Qt 6 Base — core, gui, widgets, network modules | +| qtdeclarative | custom | C++ | Qt 6 QML/QtQuick — declarative UI framework | +| qtsvg | custom | C++ | Qt 6 SVG — SVG rendering support for Qt | +| qtwayland | custom | C++ | Qt 6 Wayland — Wayland compositor/client integration | + +## system + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| coretempd | cargo | Rust | CPU core temperature monitoring daemon | +| cpufreqd | cargo | Rust | CPU frequency scaling daemon | +| cub | custom | Rust | Red Bear build utility (same as dev/cub, system-installed copy) | +| dbus | meson | C | D-Bus reference implementation — system and session message bus | +| driver-manager | custom | Rust | Driver lifecycle manager — loads/unloads drivers based on hardware | +| driver-params | cargo | Rust | Driver parameter service — exposes driver configuration via scheme | +| evdevd | custom | Rust | evdev event daemon — translates input events to evdev protocol | +| firmware-loader | cargo | Rust | Firmware loading daemon — serves GPU/device firmware blobs via scheme:firmware | +| hwrngd | cargo | Rust | Hardware RNG daemon — exposes entropy from hardware random number generator | +| iommu | cargo | Rust | IOMMU daemon — manages I/O memory mapping for device DMA | +| numad | cargo | Rust | NUMA topology daemon — exposes NUMA node information | +| redbear-accessibility | custom | Rust | Accessibility service — screen reader and input assistance bridge | +| redbear-acmd | cargo | Rust | Red Bear admin CLI — system administration commands | +| redbear-authd | cargo | Rust | Authentication daemon — PAM-like auth with scheme:auth | +| redbear-btctl | custom | Rust | Bluetooth control utility — scan, pair, connect Bluetooth devices | +| redbear-dbus-services | custom | Config | D-Bus service activation files and XML policy files for system/session buses | +| redbear-ecmd | cargo | Rust | Extended command-line tool — system diagnostics and info | +| redbear-firmware | custom | Scripts | Firmware management utility — list, extract, verify firmware blobs | +| redbear-greeter | custom | Rust | Login greeter daemon — displays graphical login prompt | +| redbear-hwutils | cargo | Rust | Hardware utility library and CLI — PCI, USB, sensor information | +| redbear-ime | custom | Rust | Input method engine — multilingual text input framework | +| redbear-info | cargo | Rust | System information daemon — hardware and OS state queries | +| redbear-keymapd | custom | Rust | Keyboard layout daemon — manages keymaps and input layouts | +| redbear-login-protocol | cargo | Rust | Login protocol crate — shared types for auth session management | +| redbear-meta | custom | Meta | Meta-package — ensures core Red Bear system packages are installed | +| redbear-mtr | cargo | Rust | MTR network diagnostic tool — traceroute + ping combined | +| redbear-netctl | cargo | Rust | Network control daemon — manages network interfaces and connections | +| redbear-netctl-console | cargo | Rust | Network control console UI — TUI for redbear-netctl | +| redbear-netstat | cargo | Rust | Network statistics tool — socket, interface, and routing info | +| redbear-nmap | cargo | Rust | Network mapper — port scanning and host discovery | +| redbear-notifications | cargo | Rust | Notification daemon — freedesktop.org notification spec implementation | +| redbear-passwd | cargo | Rust | Password management utility — change passwords, manage shadow | +| redbear-polkit | cargo | Rust | PolicyKit daemon — authorization framework for privileged operations | +| redbear-quirks | custom | Config | Hardware quirks database — TOML quirk definitions for known issues | +| redbear-sessiond | cargo | Rust | Session manager daemon — D-Bus login1 subset for KWin/Wayland | +| redbear-session-launch | cargo | Rust | Session launcher — starts desktop session compositor and services | +| redbear-statusnotifierwatcher | cargo | Rust | Status Notifier Watcher — freedesktop.org system tray spec | +| redbear-traceroute | cargo | Rust | Traceroute utility — network path discovery | +| redbear-udisks | cargo | Rust | UDisks2 daemon — storage device management via D-Bus | +| redbear-upower | cargo | Rust | UPower daemon — power management and battery status via D-Bus | +| redbear-usbaudiod | cargo | Rust | USB audio daemon — USB audio class device driver | +| redbear-wayland-guard | custom | Rust | Wayland security guard — validates compositor/client permissions | +| redbear-wifictl | cargo | Rust | Wi-Fi control utility — scan, connect, manage wireless networks | +| seatd | meson | C | seatd — seat management daemon for DRM master access | +| thermald | cargo | Rust | Thermal management daemon — monitors and controls CPU temperature | +| udev-shim | cargo | Rust | udev compatibility shim — translates libudev calls to Red Bear schemes | + +## tests + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| redox-drm-prime-test | custom | Rust | DRM PRIME buffer sharing test — validates GPU buffer import/export | +| relibc-phase1-tests | custom | C | relibc POSIX compliance tests — validates syscall wrappers and C library functions | + +## tools + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| diffutils | custom | C | GNU diffutils — diff, diff3, sdiff, cmp | + +## tui + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| mc | custom | C | GNU Midnight Commander — file manager with TUI | + +## wayland + +| Recipe | Template | Language | Description | +|--------|----------|----------|-------------| +| libwayland | custom | C | libwayland — Wayland protocol client/server library | +| qt6-wayland-smoke | custom | C++ | Qt 6 Wayland smoke test — minimal QML window on Wayland | +| redbear-compositor | cargo | Rust | Red Bear Wayland compositor — compositor shell for DRM/KMS output | +| seatd-redox | meson | C | seatd Redox backend — seat management for Red Bear's scheme system | +| smallvil | cargo | C | Smallvil — minimal wlroots-based Wayland compositor for testing | +| wayland-protocols | custom | C | Wayland protocol extensions — stable and staging protocol XML files | diff --git a/local/scripts/qemu-ram.sh b/local/scripts/qemu-ram.sh new file mode 100755 index 0000000000..0a81c17c03 --- /dev/null +++ b/local/scripts/qemu-ram.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# qemu-ram.sh — Boot Red Bear OS from RAM-disk (tmpfs) +# +# Copies the disk image into tmpfs before launching QEMU, eliminating +# all host disk I/O during OS runtime. +# +# Usage: invoked by `make qemu-ram` — not intended for direct use. +# +# Arguments: +# $1 QEMU binary (e.g. qemu-system-x86_64) +# $2 Disk image path (harddrive.img or live ISO) +# $3 QEMU flags (space-separated) +# $4 RAM directory (tmpfs mount point) + +set -euo pipefail + +QEMU_BIN="${1:?Usage: qemu-ram.sh }" +DISK="${2:?disk image path required}" +QEMU_FLAGS="${3:?QEMU flags required}" +RAMDIR="${4:?RAM directory required}" + +if [ ! -f "$DISK" ]; then + echo "ERROR: disk image not found: $DISK" >&2 + exit 1 +fi + +cleanup() { + echo "Red Bear: cleaning up RAM-disk..." + if mountpoint -q "$RAMDIR" 2>/dev/null; then + umount "$RAMDIR" 2>/dev/null || true + fi + rmdir "$RAMDIR" 2>/dev/null || true +} +trap cleanup EXIT + +# Size the tmpfs: image size + 512 MiB overhead, minimum 1 GiB +img_mb=$(du -m "$DISK" | cut -f1) +tmpfs_mb=$((img_mb + 512)) +[ "$tmpfs_mb" -lt 1024 ] && tmpfs_mb=1024 + +echo "Red Bear: preparing RAM-disk boot..." +mkdir -p "$RAMDIR" + +if ! mountpoint -q "$RAMDIR" 2>/dev/null; then + mount -t tmpfs -o "size=${tmpfs_mb}m" tmpfs "$RAMDIR" +fi + +echo "Red Bear: copying $DISK to RAM ($(du -h "$DISK" | cut -f1))..." +cp "$DISK" "$RAMDIR/disk.img" + +ram_flags="${QEMU_FLAGS//$DISK/$RAMDIR/disk.img}" + +echo "Red Bear: booting from RAM-disk..." +exec "$QEMU_BIN" $ram_flags diff --git a/mk/disk.mk b/mk/disk.mk index d3dcc72922..3c378f9c37 100644 --- a/mk/disk.mk +++ b/mk/disk.mk @@ -117,4 +117,5 @@ validate-init: $(BUILD)/harddrive.img validate: lint-config validate-init @scripts/validate-file-ownership.sh + @scripts/validate-collision-log.sh $(BUILD) @echo "\033[1;36;49mBuild validation passed\033[0m" diff --git a/mk/redbear.mk b/mk/redbear.mk index ff7352fea2..7a0ca3f845 100644 --- a/mk/redbear.mk +++ b/mk/redbear.mk @@ -32,4 +32,27 @@ sources: # Hook: run after full build $(BUILD)/harddrive.img: sources +# ── RAM-disk QEMU boot ────────────────────────────────────────────────── +# Copies harddrive.img (or live ISO) into tmpfs before booting QEMU. +# Eliminates all disk I/O during OS runtime. Requires sufficient RAM: +# QEMU_MEM (default 2048 MiB) + image size + 512 MiB overhead. +# +# Usage: +# make qemu-ram # Boot from RAM (default config) +# make qemu-ram CONFIG_NAME=redbear-full QEMU_MEM=12288 +# make qemu-ram live=yes # RAM-disk live ISO boot +# +# The tmpfs is mounted at /tmp/redbear-ram-/ and auto-cleaned on exit. + +RAMDIR=/tmp/redbear-ram-$$(id -u) + +.PHONY: qemu-ram qemu-ram-clean + +qemu-ram: qemu-deps + @bash local/scripts/qemu-ram.sh "$(QEMU)" "$(DISK)" "$(QEMUFLAGS)" "$(RAMDIR)" + +qemu-ram-clean: + @mountpoint -q $(RAMDIR) && umount $(RAMDIR) || true + @rmdir $(RAMDIR) 2>/dev/null || true + FORCE: diff --git a/scripts/validate-collision-log.sh b/scripts/validate-collision-log.sh new file mode 100755 index 0000000000..15495c13df --- /dev/null +++ b/scripts/validate-collision-log.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# validate-collision-log.sh — Check build output for CollisionTracker findings +# +# Scans the build directory for any log files containing CollisionTracker +# output ([COLLISION-ERROR] or [COLLISION-WARN] markers). The runtime +# CollisionTracker runs during image assembly in redox_installer. +# +# Exit codes: +# 0 — No collision errors found +# 1 — Collision errors detected + +set -euo pipefail + +build_dir="${1:?Usage: validate-collision-log.sh }" + +errors=0 +warnings=0 + +if [ -d "$build_dir" ]; then + while IFS= read -r logfile; do + file_errors=$(grep -c '\[COLLISION-ERROR\]' "$logfile" 2>/dev/null || true) + file_warnings=$(grep -c '\[COLLISION-WARN\]' "$logfile" 2>/dev/null || true) + if [ "$file_errors" -gt 0 ] || [ "$file_warnings" -gt 0 ]; then + echo " $logfile: $file_errors error(s), $file_warnings warning(s)" + errors=$((errors + file_errors)) + warnings=$((warnings + file_warnings)) + fi + done < <(find "$build_dir" -name '*.log' -type f 2>/dev/null) +fi + +echo "=== CollisionTracker log validation ===" +echo " Errors: $errors, Warnings: $warnings" + +if [ "$errors" -gt 0 ]; then + echo "FAILED: $errors collision error(s) in build logs" >&2 + echo " The CollisionTracker detected init service or environment file collisions." >&2 + echo " Fix: Move config [[files]] init services from /usr/lib/init.d/ to /etc/init.d/" >&2 + exit 1 +fi + +if [ "$warnings" -gt 0 ]; then + echo "WARN: $warnings non-critical collision(s) detected (not blocking)" +fi + +echo "PASSED: No collision errors"