r/osdev • • 11h ago

My Java-based OS now has a full featured X11 server with a port of OpenJDK Swing.

Post image
207 Upvotes

Small little kernel for myself. I don't really intend to publish it (it's not really gonna be anything worthwhile, other than a fun experiment).

tl;dr:

- microkernel

- yes all drivers written in java

- xhci, ehci, ochi

- pci(e) with hotplugging support, yes manual ECAM management and bus config

- custom ACPI (fuck uACPI) in Java, with my own AML parser too

- Primordial NVK-based graphics stack (can't render shit yet)

- but can atleast render virtio gpu

- 64 bit

- the JVM is most of the kernel itself (microkernel wahoo)

- ipc sucks

- custom X11 server no GLX support yet (fuck xorg)

- demand paging/swap

- versioning is mainly how many times the kernel gets updated (remember i said hotswappable kernel?) 0.2 means i hotswapped some new fancy .class via a device

- nodejs port (wip)


r/osdev • • 10h ago

I turned my Windows UEFI boot chain into a fake Linux dmesg/systemd log and a 24-bit 24 FPS GOP->Blt() video player in freestanding C17 (no external libs)

Post image
7 Upvotes

What started as a weekend prank — printing a convincing dmesg + colored systemd boot sequence before handing control off to Windows bootmgfw.efi — snowballed into a standalone bare-metal x86-64 UEFI video player written in freestanding C17 (-ffreestanding -nostdlib, zero external libraries, no EDK2 or gnu-efi CRT).

Before Windows starts loading ntoskrnl.exe, it plays a 34-second 320x180 clip integer-scaled to full screen (6x -> 1920x1080, 8x -> 2560x1440, 12x -> 3840x2160) at locked 24 FPS, skips instantly on any keystroke, and chainloads HackBGRT -> bootmgfw.efi seamlessly.

Engineering rabbit holes & fixes along the way

  1. Hooking the boot chain without touching NVRAM or BCD: When HackBGRT is installed with Secure Boot support, NVRAM points to \EFI\HackBGRT\loader.efi (Red Hat shimx64.efi), which verifies MOK + .sbat and launches \EFI\HackBGRT\grubx64.efi. Renaming the original grubx64.efi to grubx64.efi.bak lets our binary run first and chainload .bak via BS->LoadImage() + BS->StartImage(). Before chainloading, IsValidBackupEfi() scans the .bak file to make sure it doesn't contain our own LinuxBootSim or UEFI shim markers so an accidental overwrite falls back straight to \EFI\Microsoft\Boot\bootmgfw.efi instead of looping forever.
  2. Compiling PE32+ directly with MinGW (-nostdlib) & the ___chkstk_ms trap: UEFI x64 uses standard PE32+ (--subsystem,10) and Microsoft x64 ABI, so x86_64-w64-mingw32-gcc builds .efi binaries directly. Two catches:

    • Allocating >4 KB on the stack in MS x64 ABI emits an implicit ___chkstk_ms stack-probe call, breaking -nostdlib builds; moving large buffers to BS->AllocatePool() and passing -mno-stack-arg-probe keeps it clean.
    • Modern Shim (15.x/16.x) refuses to boot even MOK-enrolled hashes unless the PE image exports a valid .sbat metadata section (__attribute__((used, section(".sbat")))).
  3. Escaping the 80x25 ConSplitterDxe ceiling on AMI Aptio V: Querying SystemTable->ConOut modes often caps out at 80x25 or 100x31 on real motherboards because ConSplitterDxe exposes the intersection of GraphicsConsoleDxe and TerminalDxe (UART serial). Switching all physical EFI_GRAPHICS_OUTPUT_PROTOCOL handles to native resolution first and then probing LocateHandle(ByProtocol, &sto_guid, ...) for the handle that also carries GOP gives direct access to GraphicsConsoleDxe (240x56 text grid on 1080p).
  4. Packing 34s of 320x180 video into ~12 MB without H.264: Uncompressed BGR0 frames would take ~180 MB (bigger than Windows' default 100 MB FAT32 ESP), while EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is stuck with 16 fixed EGA colors (0x00..0x0F). Instead:

    • An offline Python encoder (and a client-side browser studio) downscales with area interpolation + thresholded unsharp mask, builds a 255-color global BGR0 palette (MedianCut + K-Means), and reserves index 255 for Temporal-Delta RLE (inter-frame skip).
    • Every (color_idx, run_length) pair is packed into a single UINT16 (0xRRCCU) so GCC parses millions of tokens in a couple of seconds without blowing up AST memory on nested struct literals.
    • At runtime, FillPixels32() writes pairs of pixels via unrolled 64-bit UINT64 stores with a 7/8-brightness scanline row per scaled block, tracks dirty_y_min .. dirty_y_max, and pushes only the modified horizontal band over PCIe via GOP->Blt(EfiBltBufferToVideo).
    • Frame pacing calibrates RDTSC against BS->Stall(20000) at startup and subtracts actual decode + blit cycles from each 41,667 us frame budget.
  5. Why USB headset audio in UEFI hits a single line in EDK2: Onboard 3.5mm / HDMI HDA audio can be driven asynchronously via OpenCore's AudioDxe.efi (EFI_AUDIO_IO_PROTOCOL DMA ring buffer). USB headsets, however, require USB Audio Class isochronous transfers — and EDK2's reference MdeModulePkg/Bus/Pci/XhciDxe implements XhcIsochronousTransfer() as a literal return EFI_UNSUPPORTED;. Detaching XhciDxe via DisconnectController() to drive BAR0 MMIO yourself immediately kills ConIn->ReadKeyStroke USB keyboard polling unless you also implement your own USB HID stack and cleanly restore controller state before bootmgfw.efi.

Source & Live Browser Encoder


r/osdev • • 18h ago

Finally I've reached a minimal FreeBSD userspace

6 Upvotes
Boot into FreeBSD Userland
SDK generates by ipc-codegen
A Server implements VfsBackend, so it can register this object to Vfs.

After a month of work, finally I've reached a minimal FreeBSD userspace.

Now it has:

  1. A userspace Mach-O loader, with dynamic link supports
  2. initd, netd, vfsd, devmgrd, usbd, acpid, etc.
  3. A multitasking system fully based on Rust Future premitives, powered by EEVDF scheduling algorithm.
  4. An object-orientd capability system inspired by seL4, Objective-C and abi_stable, which supports trait based polymorphism. The accompanying ipc-codegen can directly generate SDK crates from server-side code (the kernel is also a server). IPC calls and even system calls are as simple as calling a regular Rust crate. Kernel also provides a asynchronous primitive to support asynchronous object method calls between processes. Everything in kernel is object.
  5. A Mach-O linker written in Rust
  6. A filesystem based on GEFS

Except FreeBSD codes and a few assembly, everything is written in Rust.


r/osdev • • 12h ago

NuttX International Workshop 2026

Post image
5 Upvotes

r/osdev • • 1h ago Bravo Mindblown

LexiSuite d484004: my all-Rust local AI stack (own kernel, OS, engine, panel) - 206 changes in two days, Inkling-2-Mini at 131 tok/s on one 7900 XTX

Thumbnail
github.com
2 Upvotes

AIO USB/VM/Drive image with Inkling 2 Mini baked here: https://huggingface.co/Wa1k3r/Inkling-2-Mini-NVFP4exp-Q8-draft-LexiSuite-AIO-for-AMD-RDNA

I'm building a local AI platform from scratch in Rust: an inference engine (LexiEngine), a browser control panel (LexiPanel), an appliance OS (LexiOS) and a kernel designed around inference (LexiKernel). It boots from one USB image. It is not a wrapper around llama.cpp, and there is no third-party code in the product.

A new development image went out today. Here is what changed since the last one two days ago, and what the work actually was.

The Panel was rebuilt, page by page (66 changes)

The old Panel worked but read like an engineering console: raw JSON on screen, fields with no labels, boxes inside boxes, internal jargon everywhere. I went through it by hand.

- One header and one navigation instead of five stacked bars

- 12 themes

- A file and folder picker on every path field, so nothing has to be typed

- Right-click menus on instances, files and table cells

- Parameters grouped in the order you set them, with a device chooser for the instance's cards

- Switch an instance between LexiEngine and llama.cpp from one page

- Hardware, Diagnostics, Power, GPU tuning and Models rewritten in plain words (temperatures in degrees, problems listed first)

- An abliteration lab where you pick models with toggles and pick the drive to write to; the original is never touched

- A layout choice: top tabs, or a side tree like a hypervisor console

LexiKernel went from one core to all of them (99 changes)

Until now my kernel ran all threads of a program on a single CPU. That was the biggest gap between it and Linux. Three rounds of work went into closing it: per-CPU timers and scheduling, threads that move between cores with their full vector state, memory handled per NUMA node, huge pages, and TLB shootdowns that a core answers even in the middle of a long system call. It now boots with every core in use and served the Panel to 8 clients at 2, 4 and 8 CPUs in a VM with no failed requests.

The kernel's own GPU drivers for AMD, NVIDIA and Intel are compiled into this build too. They have not run on a real card in this version yet. That is the next milestone, and until then GPU work under LexiKernel goes through a Linux guest. The image also boots LexiOS on Linux 7.4, which is what you want for daily use today.

LexiEngine (27 changes)

- Groundwork for splitting one model across several cards (serving across cards is not in this build)

- New draft options for Inkling 2, off by default until they are measured

- A quantizer that trains with the rounding in the loop instead of rounding afterwards

- The whole tree moved to Rust 1.100.1

Speed, measured on this version

Inkling-2-Mini (the looped mixture-of-experts model released Nov 20), one Radeon RX 7900 XTX, 4-bit KV cache, greedy, one run each, measured Nov 27-28.

After a 16,384-token prompt:

- LexiEngine: prompt 2,244 tok/s, generation 64.6 tok/s, 131.1 tok/s with the model's own draft head

- llama.cpp b12722: prompt 1,060 tok/s, generation 42.9 tok/s

- Strata 0.2.23 (8-bit cache, it refuses 4-bit on this card): prompt 2,075 tok/s, generation 53.9 tok/s

Long context on LexiEngine:

- 261,632-token prompt: 1,157 tok/s reading, then 48.7 tok/s (63.2 with the draft head)

- 523,264-token prompt: 766 tok/s reading, then 39.5 tok/s (46.8 with the draft head)

- 10 of 10 planted facts recalled at both depths

Drafted output was identical to plain output in every run.

Two notes so nobody says I hid them. The llama.cpp number is from the Nov 25 build: the build I fetched today ran this model at 7.6 tok/s on this card, which looks like a bug on their side, so I did not use it. And llama.cpp needs a 26-line loader change to open my file, because the file also carries the draft head and image tower.

What it is not, yet

- A development build, not a production release

- Developed and measured on one card (7900 XTX, Vulkan). Other cards are less tested

- The kernel's own GPU drivers have not run on a card in this version

- The Windows installer is on the stick but has not been run on a Windows PC; no macOS installer yet

- Installing to an internal disk is not in this image

- Only Inkling has been benchmarked on this exact version; my 27B numbers are from a build nine days older and are being re-run

Tested

Every test in the tree ran on this version: 17,932 tests, none failed. Both images passed their Secure Boot checks in a VM.

Links

Download (381 MB USB image, boots to the Panel):

https://lexipanel.com/download/

All-in-one image with Inkling-2-Mini inside (18.1 GB, needs a 32 GB stick):

https://huggingface.co/Wa1k3r/Inkling-2-Mini-NVFP4exp-Q8-draft-LexiSuite-AIO-for-AMD-RDNA

Every one of the 206 changes, one line each:

https://github.com/W61k3r/LexiSuite-Releases/wiki/Changes-d484004

Benchmarks and method:

https://github.com/W61k3r/LexiSuite-Releases/wiki/Benchmarks

Happy to answer questions about the kernel work or the engine.