From 2b3b592dabb4e5f8c9da8ac1ab773cdc5acce0a4 Mon Sep 17 00:00:00 2001 From: Vasilito Date: Mon, 20 Apr 2026 18:37:35 +0100 Subject: [PATCH] Update tracked configs and image helpers --- config/redbear-full.toml | 70 ++++++++++++++++++++++++++++------ config/redbear-kde.toml | 39 ++++++++++++++++--- config/redbear-live-full.toml | 3 +- config/redbear-live-mini.toml | 3 +- config/wayland.toml | 63 ++++++++++++++++++++++-------- local/scripts/build-redbear.sh | 8 +--- scripts/build-iso.sh | 14 +++---- 7 files changed, 154 insertions(+), 46 deletions(-) diff --git a/config/redbear-full.toml b/config/redbear-full.toml index cc5292a9..7edf8058 100644 --- a/config/redbear-full.toml +++ b/config/redbear-full.toml @@ -1,7 +1,7 @@ # Red Bear OS Full Configuration # Primary desktop/session target: Wayland + KWin/KDE session surface on Red Bear OS. # Build: make all CONFIG_NAME=redbear-full -# Live: make live CONFIG_NAME=redbear-live-full +# Live: make live CONFIG_NAME=redbear-live-full # bare-metal live ISO only # # This is the only active full desktop target. Wayland and KDE package/runtime surfaces are folded # here instead of being split across redbear-wayland and redbear-kde. @@ -91,6 +91,7 @@ wayland-protocols = {} # Keyboard support libxkbcommon = {} +xkeyboard-config = {} libevdev = {} libinput = {} @@ -284,6 +285,11 @@ data = "" directory = true mode = 0o755 +[[files]] +path = "/usr/lib/fonts" +data = "/usr/share/fonts" +symlink = true + [[files]] path = "/usr/bin/redbear-validation-session" mode = 0o755 @@ -291,6 +297,9 @@ data = """ #!/usr/bin/env sh export DISPLAY="" +export HOME="${HOME:-/home/root}" +export USER="${USER:-root}" +export LOGNAME="${LOGNAME:-$USER}" export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-0}" export XDG_SESSION_TYPE=wayland export LIBSEAT_BACKEND=seatd @@ -308,6 +317,27 @@ if [ -z "${XDG_RUNTIME_DIR:-}" ]; then fi mkdir -p "$XDG_RUNTIME_DIR" +chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null || true + +wait_for_path() { + target="$1" + attempts=0 + while [ "$attempts" -lt 30 ]; do + if [ -e "$target" ]; then + return 0 + fi + attempts=$((attempts + 1)) + sleep 1 + done + return 1 +} + +if ! wait_for_path /run/dbus/system_bus_socket; then + echo "system D-Bus socket did not appear" >&2 + exit 1 +fi + +sleep 2 wait_for_wayland_socket() { socket_path="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" @@ -329,16 +359,18 @@ if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]; then eval "$(dbus-launch --sh-syntax)" fi -let validation_request = "/run/redbear-kde-session.validation-request" -let validation_success = "/run/redbear-kde-session.validation-success" +validation_request="/run/redbear-kde-session.validation-request" +validation_success="/run/redbear-kde-session.validation-success" -if test -f $validation_request - echo "user=$USER" > $validation_success - echo "runtime=$XDG_RUNTIME_DIR" >> $validation_success - echo "wayland=$WAYLAND_DISPLAY" >> $validation_success - rm -f $validation_request +if [ -f "$validation_request" ]; then + { + echo "user=$USER" + echo "runtime=$XDG_RUNTIME_DIR" + echo "wayland=$WAYLAND_DISPLAY" + } > "$validation_success" + rm -f "$validation_request" exit 0 -end +fi dbus-update-activation-environment \ DBUS_SESSION_BUS_ADDRESS \ @@ -354,7 +386,12 @@ if [ -d /usr/share/glib-2.0/schemas ]; then glib-compile-schemas /usr/share/glib-2.0/schemas/ fi -kwin_wayland --replace & +if [ -n "$KWIN_DRM_DEVICES" ]; then + kwin_wayland_wrapper --drm & +else + echo "redbear-validation-session: using virtual KWin backend (set KWIN_DRM_DEVICES to enable DRM)" >&2 + kwin_wayland_wrapper --virtual & +fi kwin_pid=$! if ! wait_for_wayland_socket; then @@ -452,12 +489,18 @@ export KDE_FULL_SESSION=true export XDG_CURRENT_DESKTOP=KDE export LIBSEAT_BACKEND=seatd export SEATD_SOCK=/run/seatd.sock +export QT_PLUGIN_PATH="${QT_PLUGIN_PATH:-/usr/plugins}" +export QT_QPA_PLATFORM_PLUGIN_PATH="${QT_QPA_PLATFORM_PLUGIN_PATH:-/usr/plugins/platforms}" +export QML2_IMPORT_PATH="${QML2_IMPORT_PATH:-/usr/qml}" +export XCURSOR_THEME="${XCURSOR_THEME:-Pop}" +export XKB_CONFIG_ROOT="${XKB_CONFIG_ROOT:-/usr/share/X11/xkb}" if [ -z "${XDG_RUNTIME_DIR:-}" ]; then export XDG_RUNTIME_DIR="/tmp/run/user/$(id -u)" fi mkdir -p "$XDG_RUNTIME_DIR" +chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null || true if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]; then eval "$(dbus-launch --sh-syntax)" @@ -490,5 +533,10 @@ dbus-update-activation-environment \ HOME \ USER -exec kwin_wayland --replace +if [ -n "$KWIN_DRM_DEVICES" ]; then + exec kwin_wayland_wrapper --drm +else + echo "redbear-kde-session: using virtual KWin backend (set KWIN_DRM_DEVICES to enable DRM)" >&2 + exec kwin_wayland_wrapper --virtual +fi """ diff --git a/config/redbear-kde.toml b/config/redbear-kde.toml index 1f7b18d2..2dd70805 100644 --- a/config/redbear-kde.toml +++ b/config/redbear-kde.toml @@ -123,7 +123,6 @@ data = "" directory = true mode = 0o755 -# ── Red Bear OS custom services ───────────────────────────────────── [[files]] path = "/usr/lib/init.d/12_dbus.service" data = """ @@ -304,7 +303,6 @@ args = ["/scheme/debug/no-preserve", "-J"] type = "oneshot_async" """ -# KDE session launcher [[files]] path = "/usr/bin/redbear-kde-session" mode = 0o755 @@ -312,24 +310,52 @@ data = """ #!/usr/bin/sh export DISPLAY="" +export HOME="${HOME:-/home/root}" +export USER="${USER:-root}" +export LOGNAME="${LOGNAME:-$USER}" export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-0}" export XDG_SESSION_TYPE=wayland export KDE_FULL_SESSION=true export XDG_CURRENT_DESKTOP=KDE export LIBSEAT_BACKEND=seatd export SEATD_SOCK=/run/seatd.sock +export QT_PLUGIN_PATH="${QT_PLUGIN_PATH:-/usr/plugins}" +export QT_QPA_PLATFORM_PLUGIN_PATH="${QT_QPA_PLATFORM_PLUGIN_PATH:-/usr/plugins/platforms}" +export QML2_IMPORT_PATH="${QML2_IMPORT_PATH:-/usr/qml}" +export XCURSOR_THEME="${XCURSOR_THEME:-Pop}" +export XKB_CONFIG_ROOT="${XKB_CONFIG_ROOT:-/usr/share/X11/xkb}" if [ -z "${XDG_RUNTIME_DIR:-}" ]; then export XDG_RUNTIME_DIR="/tmp/run/user/$(id -u)" fi mkdir -p "$XDG_RUNTIME_DIR" +chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null || true + +wait_for_path() { + target="$1" + attempts=0 + while [ "$attempts" -lt 30 ]; do + if [ -e "$target" ]; then + return 0 + fi + attempts=$((attempts + 1)) + sleep 1 + done + return 1 +} + +if ! wait_for_path /run/dbus/system_bus_socket; then + echo "system D-Bus socket did not appear" >&2 + exit 1 +fi + +sleep 2 if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]; then eval "$(dbus-launch --sh-syntax)" fi -# Export session environment to D-Bus activation dbus-update-activation-environment \ DBUS_SESSION_BUS_ADDRESS \ DBUS_SESSION_BUS_PID \ @@ -344,6 +370,9 @@ dbus-update-activation-environment \ HOME \ USER -# Start KWin Wayland compositor -exec kwin_wayland --replace +if [ -z "${KWIN_DRM_DEVICES:-}" ] && [ -e /scheme/drm/card0 ]; then + export KWIN_DRM_DEVICES=/scheme/drm/card0 +fi + +exec kwin_wayland_wrapper --drm """ diff --git a/config/redbear-live-full.toml b/config/redbear-live-full.toml index 6dd48585..ef3805b4 100644 --- a/config/redbear-live-full.toml +++ b/config/redbear-live-full.toml @@ -1,7 +1,8 @@ # Red Bear OS Live Full Configuration -# Live ISO variant for the primary full desktop/session target. +# Live ISO variant for the primary full desktop/session target on real bare metal. # # Build: make live CONFIG_NAME=redbear-live-full +# This ISO is for real bare-metal boot/install/recovery, not VM/QEMU use. include = ["redbear-full.toml"] diff --git a/config/redbear-live-mini.toml b/config/redbear-live-mini.toml index 99732567..cbf59a88 100644 --- a/config/redbear-live-mini.toml +++ b/config/redbear-live-mini.toml @@ -1,7 +1,8 @@ # Red Bear OS Mini Live Configuration -# Minimal boot-test live ISO variant. +# Minimal boot-test live ISO variant for real bare metal. # # Build: make live CONFIG_NAME=redbear-live-mini +# This ISO is for real bare-metal boot/recovery, not VM/QEMU use. include = ["minimal.toml", "redbear-legacy-base.toml"] diff --git a/config/wayland.toml b/config/wayland.toml index 8c93da7d..e85903f6 100644 --- a/config/wayland.toml +++ b/config/wayland.toml @@ -4,14 +4,20 @@ include = ["desktop.toml", "redbear-legacy-base.toml", "redbear-legacy-desktop.toml", "redbear-device-services.toml", "redbear-netctl.toml"] -# Override the default settings here - -# General settings [general] -# Filesystem size in MiB filesystem_size = 2048 -# Package settings +[users.messagebus] +uid = 100 +gid = 100 +name = "messagebus" +home = "/nonexistent" +shell = "/usr/bin/false" + +[groups.messagebus] +gid = 100 +members = ["messagebus"] + [packages] redbear-release = {} redbear-hwutils = {} @@ -93,13 +99,15 @@ args = [ type = "oneshot_async" """ -# Replace the legacy desktop-minimal init script with an explicit service unit. [[files]] path = "/usr/lib/init.d/20_display.service" data = """ [unit] description = "Display session service (Wayland validation)" requires_weak = [ + "12_dbus.service", + "13_redbear-sessiond.service", + "13_seatd.service", ] [service] @@ -156,7 +164,7 @@ type = "oneshot_async" [[files]] path = "/usr/bin/redbear-validation-session" mode = 0o755 - data = """ +data = """ #!/usr/bin/env sh export DISPLAY="" @@ -177,6 +185,27 @@ if [ -z "${XDG_RUNTIME_DIR:-}" ]; then fi mkdir -p "$XDG_RUNTIME_DIR" +chmod 700 "$XDG_RUNTIME_DIR" 2>/dev/null || true + +wait_for_path() { + target="$1" + attempts=0 + while [ "$attempts" -lt 30 ]; do + if [ -e "$target" ]; then + return 0 + fi + attempts=$((attempts + 1)) + sleep 1 + done + return 1 +} + +if ! wait_for_path /run/dbus/system_bus_socket; then + echo "system D-Bus socket did not appear" >&2 + exit 1 +fi + +sleep 2 wait_for_wayland_socket() { socket_path="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" @@ -212,7 +241,14 @@ if [ -d /usr/share/glib-2.0/schemas ]; then glib-compile-schemas /usr/share/glib-2.0/schemas/ fi -kwin_wayland --replace & +export XCURSOR_THEME="${XCURSOR_THEME:-Pop}" +export XKB_CONFIG_ROOT="${XKB_CONFIG_ROOT:-/usr/share/X11/xkb}" + +if [ -z "${KWIN_DRM_DEVICES:-}" ] && [ -e /scheme/drm/card0 ]; then + export KWIN_DRM_DEVICES=/scheme/drm/card0 +fi + +kwin_wayland_wrapper --drm & kwin_pid=$! if ! wait_for_wayland_socket; then @@ -229,8 +265,10 @@ mode = 0o755 data = """ #!/usr/bin/env ion -# env G_MAIN_POLL_DEBUG=1 G_MESSAGES_DEBUG=all LD_DEBUG=all WEBKIT_DEBUG=all MiniBrowser& -printenv +export HOME=/home/root +export USER=root +export LOGNAME=root + let session_started = "$HOME/.wayland-session.started" rm -f $session_started echo "started" > $session_started @@ -257,11 +295,6 @@ rm -f $bootstrap_ok $bootstrap_log rm -f $plugin_ok $plugin_err $plugin_log rm -f $smoke_minimal_ok $smoke_offscreen_ok $smoke_wayland_ok rm -f $smoke_minimal_log $smoke_offscreen_log $smoke_wayland_log -#wayland-rs_simple_window -#winit-wayland_window -#softbuffer-wayland_animation -#iced-wayland_sctk_lazy -#gtk3-widget-factory if which qt6-wayland-smoke >/scheme/null if test -f /usr/plugins/platforms/libqminimal.so echo "=== qminimal ELF header (guest) ===" diff --git a/local/scripts/build-redbear.sh b/local/scripts/build-redbear.sh index a4063235..95c59a58 100755 --- a/local/scripts/build-redbear.sh +++ b/local/scripts/build-redbear.sh @@ -137,7 +137,6 @@ ensure_relibc_desktop_surface() { fi } -# Step 0: Apply local patches if [ "$APPLY_PATCHES" = "1" ]; then echo ">>> Applying local patches..." @@ -194,7 +193,6 @@ if [ "$APPLY_PATCHES" = "1" ]; then echo "" fi -# Step 1: Build cookbook binary if [ ! -f "target/release/repo" ]; then echo ">>> Building cookbook binary..." cargo build --release @@ -204,7 +202,6 @@ if [ "$CONFIG" = "redbear-full" ] || [ "$CONFIG" = "redbear-live-full" ]; then ensure_relibc_desktop_surface fi -# Step 2: Check firmware FW_AMD_DIR="$PROJECT_ROOT/local/firmware/amdgpu" if [ "$CONFIG" != "redbear-minimal" ]; then if [ -d "$FW_AMD_DIR" ] && [ -n "$(ls -A "$FW_AMD_DIR" 2>/dev/null)" ]; then @@ -218,7 +215,6 @@ if [ "$CONFIG" != "redbear-minimal" ]; then echo "" fi -# Step 3: Build echo ">>> Building Red Bear OS with config: $CONFIG" echo ">>> This may take 30-60 minutes on first build..." if [ "$ALLOW_UPSTREAM" -eq 1 ]; then @@ -229,7 +225,6 @@ else REPO_OFFLINE=1 COOKBOOK_OFFLINE=true CI=1 make all "CONFIG_NAME=$CONFIG" "JOBS=$JOBS" fi -# Step 4: Report ARCH="${ARCH:-$(uname -m)}" echo "" echo "========================================" @@ -270,6 +265,7 @@ fi echo "" echo "To build live ISO:" echo " make live CONFIG_NAME=$CONFIG" +echo " # live .iso outputs are for real bare metal, not VM/QEMU use" echo "" -echo "To burn to USB (verify device first!):" +echo "To write a real bare-metal image to USB (verify device first!):" echo " dd if=build/$ARCH/$CONFIG/harddrive.img of=/dev/sdX bs=4M status=progress" diff --git a/scripts/build-iso.sh b/scripts/build-iso.sh index a643128e..8a8654bc 100755 --- a/scripts/build-iso.sh +++ b/scripts/build-iso.sh @@ -1,10 +1,5 @@ #!/usr/bin/env bash -# Build Red Bear OS live ISO -# Usage: ./scripts/build-iso.sh [--upstream] [CONFIG_NAME] [ARCH] -# CONFIG_NAME - build config (default: redbear-live) -# ARCH - target architecture (default: x86_64) - set -euo pipefail CONFIG_NAME="redbear-live" @@ -15,7 +10,11 @@ usage() { cat <