vasilito a4dc44a8e0 redbear-power: v1.6 — Battery tab (power_supply)
Adds the 5th tab in the multi-view system: Battery, reading
power_supply data from /sys/class/power_supply/BAT*/ on Linux hosts.

New module battery.rs (128 lines):
- BatteryInfo struct with 15 fields (available, name, status,
  capacity_percent, energy_now_wh, energy_full_wh, power_now_w,
  voltage_now_v, time_to_empty_s, time_to_full_s, cycle_count,
  technology, model_name, manufacturer, serial_number)
- find_battery_dir() scans /sys/class/power_supply/ for type==Battery
- read() populates all fields with inline µWh→Wh, µV→V conversion
- health_percent() computes current_charge / full_charge ratio
- display/display_u32/display_u64/display_f64 helpers
- format_duration(secs) — Xh Ym / Ym Zs / Zs
- RBP_BATTERY_PATH env override (testing + dev workflow)

Updated app.rs:
- New field battery: BatteryInfo, initialized once in App::new()
- TabId::Battery variant (5th tab)
- TabId::next() cycles PerCpu → System → Info → Motherboard → Battery

Updated render.rs:
- New render_battery_panel(app, focused) with 3 section blocks
  (Identity / State / Power). If !available, shows
  '(no battery detected — /sys/class/power_supply/BAT* not present)'.
- render_tab_bar() updated for 5 tabs with hotkey 1/2/3/4/5 mapping
- render_once now dumps Battery panel for headless verification

Updated main.rs:
- mod battery; declaration
- New dispatch arm TabId::Battery => render_battery_panel
- Hotkey 5 jumps to Battery tab directly
- render_battery_panel added to imports

Mock battery smoke test (RBP_BATTERY_PATH=/tmp/fake-battery):
- Manufacturer: MSI, Model: MPG X670E, Technology: Li-ion, Cycles: 127
- Status: Discharging, Capacity: 67%, Health: 67%
- Energy: 33.50 Wh / 50.00 Wh (µWh→Wh conversion verified)
- Power: 8.50 W, Voltage: 12.50 V (µV→V conversion verified)
- Time to empty: 3h 0m, Time to full: ? (correctly hidden when 0)

On desktop (no battery):
(no battery detected — /sys/class/power_supply/BAT* not present)

Source state: 4359 LoC across 15 modules (v1.5: 4117/14).
Redox stripped: 3.8 MB (SHA256 c6fca172...).

Docs: improvement plan §30, CONSOLE-TO-KDE §3.3.2 v1.6,
RATATUI-APP-PATTERNS §13.18 + §14.
2026-06-20 17:44:11 +03:00
2026-06-18 20:45:28 +03:00

Red Bear OS

Red Bear OS

A microkernel operating system written in Rust, derived from Redox OS

MIT x86_64 Status


What is Red Bear OS?

Red Bear OS is a general-purpose, Unix-like operating system with a microkernel architecture, written in Rust. It is a full fork of Redox OS, frozen at release 0.1.0, with added hardware support, filesystem drivers, and a KDE Plasma desktop path.

Goals:

  • AMD & Intel parity — first-class support for both platforms on bare metal
  • KDE Plasma desktop — Wayland-based desktop environment via the KWin compositor
  • Hardware GPU acceleration — AMD GPU (amdgpu) and Intel GPU drivers via redox-drm
  • Modern subsystems — USB, WiFi, Bluetooth, ext4, GRUB, D-Bus
  • Offline-first builds — reproducible from archived, BLAKE3-verified sources

Quick Start

Prerequisites

Linux x86_64 host with Rust nightly, QEMU, nasm, and standard build tools.
See the Redox Build Guide for full setup.

Build & Run

# Clone
git clone https://gitea.redbearos.org/vasilito/RedBear-OS.git
cd RedBear-OS

# Recommended: use the Red Bear wrapper
./local/scripts/build-redbear.sh redbear-mini     # Text-only target
./local/scripts/build-redbear.sh redbear-full     # Desktop-capable target

# Boot in QEMU with the resulting image
make qemu

Build script: local/scripts/build-redbear.sh is the canonical entry point. Bare make all works but bypasses the .config checking and REDBEAR_ALLOW_PROTECTED_FETCH=1 gates that build-redbear.sh enforces. See AGENTS.md § Build Commands for full details.

Public Scripts

Script Purpose
local/scripts/build-redbear.sh Canonical build wrapper for redbear-mini/full/grub
scripts/run.sh Build and run in QEMU (-b to build, -c <config> for target)
scripts/build-iso.sh Build a live ISO for bare-metal boot
scripts/build-all-isos.sh Build all live ISO targets
scripts/network-boot.sh PXE network boot helper
scripts/dual-boot.sh Dual-boot installation helper

Config Targets

Target Type Description
redbear-full Desktop Wayland + KDE + GPU drivers + D-Bus services
redbear-mini Console Text-only recovery / install target
redbear-grub Console Text-only with GRUB boot manager

Current Status

Red Bear OS boots to a login prompt in QEMU with working wired networking, D-Bus system bus, hardware detection daemons, and filesystem support (RedoxFS, ext4, FAT).

Area Status
Boot (ACPI/x2APIC/SMP) Bare-metal proven
Userspace drivers (PCI, storage, net) Working in QEMU
D-Bus system bus + services Working (login1, PolicyKit, UDisks, UPower)
ext4 / FAT filesystems Compiles, installer-wired
POSIX gaps (relibc) 🚧 Bounded Wayland-facing support
DRM/KMS display drivers 🚧 AMD + Intel compile; HW validation pending
Wayland compositor 🚧 Bounded proof; Qt6/KF6 clients crash at init
KDE Plasma desktop 🔄 In progress (Qt6/KF6 compile; KWin/QML blocked)
WiFi / Bluetooth 📋 Planned (architected, implementation pending)

How It Works

Red Bear OS uses a userspace driver model — all drivers run as unprivileged daemons:

Kernel (microkernel)
  └── schemes: memory, irq, event, pipe, debug
        └── Driver daemons (userspace)
              ├── pcid        → PCI enumeration
              ├── e1000d      → Intel ethernet
              ├── xhcid       → USB controller
              └── vesad       → Display framebuffer

The kernel provides minimal services (memory, interrupts, IPC). Everything else — filesystems, networking, graphics, input — runs in userspace.

Documentation

Contributing

Red Bear OS uses a full fork model. Upstream Redox sources are frozen and archived. All custom work lives in local/:

local/
├── patches/    # Durable changes to upstream source trees
├── recipes/    # Custom packages (drivers, GPU, system)
├── docs/       # Integration and planning docs
└── scripts/    # Build, test, and release tooling

We welcome contributions made with or without AI assistance — we care about quality, not how the code was produced.

License

MIT — same as upstream Redox OS.

S
Description
RedBear Operating System, based on RedoxOS. Licenced under MIT license.
https://redbearos.org
Readme MIT 20 GiB
Languages
C 43.9%
C++ 23.5%
Makefile 7.3%
Python 3.7%
JavaScript 3.4%
Other 17.1%