A microkernel OS, written in Rust, and based on Xinu.
Go to file
2025-03-13 13:09:45 -04:00
.cargo It boots! 2025-02-10 14:14:17 -05:00
.vscode Fixes for shell.nix 2025-03-07 17:43:53 -05:00
src/kernel Set up some stuff for syscalls? 2025-03-13 13:09:45 -04:00
.envrc It boots! 2025-02-10 14:14:17 -05:00
.gitignore Replace shell script with makefile 2025-02-11 23:31:16 -05:00
build.rs Reorganize, process capabilities 2025-03-13 00:28:50 -04:00
Cargo.lock Reorganize, process capabilities 2025-03-13 00:28:50 -04:00
Cargo.toml Reorganize, process capabilities 2025-03-13 00:28:50 -04:00
LICENSE Added README and LICENSE 2025-02-09 20:59:44 -05:00
limine.conf Reorganize, process capabilities 2025-03-13 00:28:50 -04:00
Makefile Reorganize, process capabilities 2025-03-13 00:28:50 -04:00
README.md Fix README 2025-03-13 00:30:50 -04:00
rust-toolchain.toml build tool stuff 2025-02-10 14:22:53 -05:00
shell.nix I screwed up the shell.nix again 2025-03-07 18:28:19 -05:00

Gila v0.2.3 - a Rust Microkernel

Gila is a Rust microkernel OS, inspired by the Xinu embedded OS, as well as Linux. I aim to implement multitasking and different users for processes, and eventually a filesystem. I do not aim to make it POSIX-compatible, but it will likely end up sharing many features with POSIX operating systems.

Features

Complete

  • Builds for multiple architectures
  • Valid Limine kernel
  • Boots on x86_64
  • Kernel command line parameters
  • Logging

In-Progress

  • Multi-architecture feature support
  • Display console
  • Serial console

Future/Desired

  • Code execution
  • Interrupts and timers
  • Context switching
  • Process scheduling
  • Shell and CLI
  • System calls (multi-convention?)
  • Multi-user support and access control
  • Simultaneous multiprocessing support
  • ACPI, USB, PCI(e), SATA
  • Filesystem support (FAT32)
  • Application sandboxing/permissions control
  • Graphical desktop environment
  • Networking support

Licensing

Licensed under the GNU Public License v3. See LICENSE for details.

Navigating

  • arch/: Architecture specific features like the display, serial, and interrupts. Each architecture is a subfolder, containing a file or module for each feature.
  • boot.rs: Handles bootloader-managed data structures. Gila uses Limine. Other bootloaders are NOT supported.
  • log.rs: Logging structures and singletons for logging to serial or the display.
  • main.rs: The entry point that gets called by the bootloader.
  • memory.rs: Types relating to memory regions and allocation.
  • panic.rs: The panic handler and associated functionality.
  • params.rs: Kernel parameter handler code.
  • process.rs: Process types and functions.
  • resources.rs: Resources that are accessible from multiple parts of the code.

Building and running

Building a bootable kernel is easy. All you need to do is run cargo build gila, and a valid, bootable Limine executable will be generated. However, it cannot be booted without installing it in a bootable Limine filesystem.

To build an ISO image that you can boot, there are several prerequisites:

  • rustup command installed
  • limine command installed
  • xorriso command installed
  • make command installed
  • qemu-system-{your target architecture} command installed (for running)

Then run make to invoke the Makefile.

  • make checkenv: Asserts all needed commands and resources are accessible.
  • make prepare: Installs needed Rust toolchain.
  • make clean: Cleans all built binaries, libraries, and ISOs.
  • make kernel: Builds the kernel ELF file.
  • make iso: Builds the bootable ISO with Limine installed.
  • make run: Builds the ISO and boots it in QEMU.

To change the target gila will be compiled or run for, supply TARGET={valid-rustc-targettriple} either as an argument to make or as an environment variable. The default is x86_64-unknown-none.

To change the search path for limine's binaries, supply LIMINEDIR=/some/valid/path/no/trailing/slash either as an argument to make or as an environment variable. The default is /usr/share/limine.

If you use Nix, you can install all these dependencies automatically by running nix-shell. This will also automatically set the correct directory for the limine BIOS files.

Important

I do not, and cannot, currently recommend using nix for dependency management. nixpkgs does not ship all of the necessary files in its packaging of limine.

Kernel Parameters

Kernel parameters are passed as part of the cmdline through limine.conf. The parameters are passed as a space-delimited list of keys and values. Keys begin with a hyphen (-), and keys are separated from their values with equals signs (=). Keys can have a set of multiple values, separated by a comma (,). Gila does not currently support parameter values with spaces. That would require an actual parser.

List of current extant kernel parameters:

  • -loglevel: Can be a number or string corresponding to a log level. Only one value supported.
  • -logdev: A sequence of one or more values representing devices to log to. Current options are display and serial.

The default cmdline is:

-loglevel=INFO -logdev=display,serial

Credits

The linker script stuff is from limine-rust-template, which is available under the BSD 0-Clause License.