Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyOS

TinyOS is a deliberately minimal x86_64 hobby kernel written in Rust. The first milestone is an interactive kernel monitor that boots in QEMU, prints text, logs over serial, reads a PS/2 keyboard, exposes a tiny shell, and stores files in RAM.

TinyOS

Current status: TinyOS 0.2 GUI desktop complete. The kernel boots through Limine, initializes a basic x86_64 IDT, remaps the PIC, enables PS/2 keyboard and mouse IRQs, clears the VGA text screen, prints:

TinyOS booted
>

logs boot/panic messages to the first serial port, idles with hlt until interrupts arrive, edits a fixed-size input line from basic US-layout PS/2 keyboard or interrupt-driven serial input, and runs a tiny host-tested shell with help, version, clear, halt, reboot, mem, uptime, desktop, open, edit, echo, ls, cat, write, rm, and stat backed by a flat in-memory filesystem. The desktop command enables the TinyOS 0.2 framebuffer desktop at 1024x768x32 with larger bitmap labels, larger draggable/closable windows, serial open sysinfo / open terminal / open editor controls, edit <text>, optimized double-buffered rendering, cursor-only mouse repaints, and a software mouse cursor when PS/2 mouse input is available.

Requirements

  • Rust with the x86_64-unknown-none target:

    rustup target add x86_64-unknown-none
  • make

  • git

  • xorriso for make iso / make run

  • mtools and parted for make hdd / make run-hdd

  • qemu-system-x86_64 with SDL display support (qemu-ui-sdl or qemu-desktop on Arch)

Test

Host-unit-test the shell parser and line buffer:

cargo test --manifest-path kernel/Cargo.toml --target x86_64-unknown-linux-gnu

Build

make iso

This builds kernel/target/x86_64-unknown-none/debug/tinyos, downloads Limine into .build/limine, and creates tinyos.iso.

If xorriso is unavailable, build a bootable raw HDD image instead:

make hdd

This creates tinyos.img.

Run

Graphical QEMU run, with SDL display by default for better mouse capture, PS/2 keyboard input captured by the QEMU window, and serial I/O in the terminal:

make run

make run is an alias for:

make run-gui

You can type shell commands either in the QEMU window after clicking it, or in the terminal attached to serial I/O. Press Ctrl+Alt+G to release keyboard/mouse capture. To use GTK instead of SDL, run GUI_DISPLAY=gtk make run-gui.

GUI manual smoke test

Run the graphical target:

make run-gui

At the serial prompt, run:

desktop smoke
open sysinfo
open terminal
edit hello from TinyOS
open editor
desktop redraw
desktop off
desktop

Expected serial output includes desktop smoke ok, opened sysinfo, opened terminal, editor updated, opened editor, desktop redrawn, desktop off, and desktop on. Expected QEMU behavior: SDL captures the mouse while the window is focused, the TinyOS cursor moves inside the desktop, System Info updates once per second, the Terminal window mirrors recent shell activity, and the Editor shows the latest edit <text> content. Press Ctrl+Alt+G to release capture if needed.

For a headless command smoke, build the ISO and pipe the smoke commands into serial:

{ sleep 3; printf 'desktop smoke\ndesktop off\n'; } | timeout 12 qemu-system-x86_64 -cdrom tinyos.iso -serial stdio -display none -no-reboot -no-shutdown

The timeout terminates QEMU after the smoke output appears; seeing desktop smoke ok and desktop off means the GUI command path rendered successfully.

Headless serial-only run, where shell commands are typed directly in the terminal:

make run-headless

Or, for the raw HDD image path:

make run-hdd

Equivalent QEMU commands:

qemu-system-x86_64 -cdrom tinyos.iso -serial stdio -display sdl -no-reboot -no-shutdown
qemu-system-x86_64 -cdrom tinyos.iso -serial stdio -display gtk -no-reboot -no-shutdown
qemu-system-x86_64 -cdrom tinyos.iso -serial stdio -display none -no-reboot -no-shutdown
qemu-system-x86_64 -drive format=raw,file=tinyos.img -serial stdio -no-reboot -no-shutdown

Roadmap

See docs/ROADMAP.md for the completed TinyOS 0.1 monitor and TinyOS 0.2 GUI desktop summary. See docs/RELEASE_0_2.md for TinyOS 0.2 release notes.

Debug with GDB

make run-debug

Then attach GDB to QEMU's server on port 1234.

About

Tiny OS with custom Rust kernel

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages