Loading repository dataโฆ
Loading repository dataโฆ
theseus-os / repository
Theseus is a modern OS written from scratch in Rust that explores ๐ข๐ง๐ญ๐ซ๐๐ฅ๐ข๐ง๐ ๐ฎ๐๐ฅ ๐๐๐ฌ๐ข๐ ๐ง: closing the semantic gap between compiler and hardware by maximally leveraging the power of language safety and affine types. Theseus aims to shift OS responsibilities like resource management into the compiler.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Theseus is a new OS written from scratch in Rust to experiment with novel OS structure, better state management, and how to leverage intralingual design principles to shift OS responsibilities like resource management into the compiler.
For more info, check out Theseus's documentation or our published academic papers, which describe Theseus's design and implementation.
Theseus is under active development, and although it is not yet mature, we envision that Theseus will be useful in high-end embedded systems or edge datacenter environments. We are continually working to improve the OS, including its fault recovery abilities for higher system availability without redundancy, as well as easier and more arbitrary live evolution and runtime flexibility.
On Linux (Debian-like distros), do the following:
git clone --recurse-submodules --depth 1 https://github.com/theseus-os/Theseus.git
curl https://sh.rustup.rs -sSf | sh
sudo apt-get install make gcc nasm pkg-config grub-pc-bin mtools xorriso qemu qemu-kvm wget
cd Theseus
make run
To exit QEMU, press Ctrl + A, then X.See below for more detailed instructions.
Note: when you first check out the project, be sure to get all the submodule repositories too:
git submodule update --init --recursive
Currently, we support building Theseus on the following platforms:
First, install Rust by following the setup instructions here. On Linux, just run:
curl https://sh.rustup.rs -sSf | sh
Install the following dependencies using your package manager:
sudo apt-get install make gcc nasm pkg-config grub-pc-bin mtools xorriso qemu qemu-kvm wget
# Arch Linux
sudo pacman -S make gcc nasm pkg-config grub mtools xorriso qemu wget
# Fedora
sudo dnf install make gcc nasm pkg-config grub2 mtools xorriso qemu wget
If you're on WSL, also do the following steps:
Install an X Server for Windows; we suggest using Xming or VcXsvr.
-ac argument (or use the GUI to disable access control).Setup an X display as follows:
export DISPLAY=:0
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
You'll need to do this each time you open up a new WSL terminal, so it's best to add it to the end of your .bashrc or .profile file in your $HOME directory.
If you get an error like Could not initialize SDL (No available video device) ... or any type of GTK or video device error, then make sure that your X Server is running and that you have set the DISPLAY environment variable above.
NOTE: WSL and WSL2 do not currently support using KVM.
Install HomeBrew, then run the MacOS build setup script:
sh ./scripts/mac_os_build_setup.sh
If things go wrong, remove the following build directories and try to run the script again.
rm -rf /tmp/theseus_tools_src
NOTE: on MacOS, you need to run gmake instead of make for build commands (or you can simply create a shell alias).
(This is typically not necessary): if you're building Theseus on older Apple Silicon (M1 chips), you may need to use bash with x86 emulation:
arch -x86_64 bash # or another shell of your choice
and possibly adjust your system PATH if both x86 and ARM homebrew binaries are installed:
export PATH=/usr/local/Homebrew/bin:$PATH
Note: building and running Theseus within a Docker container may be slower than on a native host OS.
Ensure docker scripts are executable:
chmod +x docker/*.sh
(Skip if docker is already installed.) Install Docker Engine. We provide a convenience script for this on Ubuntu:
./docker/install_docker_ubuntu.sh
sudo groupadd docker; sudo usermod -aG docker $USERBuild the docker image:
./docker/build_docker.sh
This does not build Theseus, but rather only creates a docker image that contains all the necessary dependencies to build and run Theseus.
Run the new docker image locally as a container:
./docker/run_docker.sh
Now you can run make run or other Theseus-specific build/run commands from within the docker container's shell.
Notes on Docker usage:
run_docker.sh script multiple times when re-building or running Theseus after modifying its code. You shouldn't need to re-run build_docker.sh multiple times, though it won't hurt.), and then run make orun host=yes` on your host machine.Build the default Theseus OS image and run it in QEMU:
make run
Or, build a full Theseus OS image with all features and crates enabled:
make full ## or `make all`
Run make help to see other make targets and the various command-line options.
To use Limine instead of GRUB, clone pre-built limine and pass bootloader=limine to make:
git clone https://github.com/limine-bootloader/limine.git limine-prebuilt
git -C limine-prebuilt reset --hard 3f6a330
make run bootloader=limine
Feel free to try newer versions, however they may not work.
Support for Theseus on aarch64 is an ongoing effort, but most of the core subsystems are complete.
To build and run Theseus on aarch64, first install the required dependencies:
sudo apt-get install qemu-system-arm gcc-aarch64-linux-gnu
sudo pacman -S aarch64-linux-gnu-gcc qemu-system-aarch64
mac_os_build_setup script should have already installed this for you, but if not:
brew install aarch64-elf-gcc aarch64-elf-binutils
Then, build Theseus and run it in QEMU:
make ARCH=aarch64 run
Doing a "full" build of all Theseus crates isn't yet supported on aarch64, as our aarch64 support in Theseus doesn't yet cover all crates in the entire repo.
QEMU allows us to run Theseus quickly and easily in its own virtual machine.
To release your keyboard and mouse focus from the QEMU window, press Ctrl + Alt + G, or Ctrl + Alt on some systems, or just Cmd + Tab out to another app on macOS.
To exit QEMU, in the terminal window that you originally ran make run, press Ctrl + A then X, or you can also click the GUI โง button on the title bar if running QEMU in graphical mode.
To investigate the hardware/machine state of the running QEMU VM, you can switch to the QEMU console by pressing Ctrl + Alt + 2.
Switch back to the main window with Ctrl + Alt + 1.
On Mac, manually select VGA or compact_monitor0 under View from the QEMU menu bar.
To access/expose a PCI device in QEMU using PCI passthrough via VFIO, see these instructions.
Linux does not support the ICMP protocol (for ping) for guest OSes in QEMU by default, so to allow ping to work on Theseus, you may need to run the following in your Linux host machine:
sudo sh -c "echo \"0 2147483647\" > /proc/sys/net/ipv4/ping_group_range"
While not strictly required, KVM will speed up the execution of QEMU. To install KVM, run the following command:
sudo apt-get install kvm
To enable KVM support, add host=yes to your make command, e.g.,
make run host=yes
Note that KVM acceleration is only supported on native Linux hosts.
Theseus includes two forms of documentation:
To build the documentation yourself, set up your local build environment and then run the following:
make view-doc ## for the source-level docs
make view-book ## for the Theseus book
We have tested Theseus on a variety of real machines, including Intel NUC devices, various Thinkpad laptops, and Supermicro servers. Currently, we have only tested booting Theseus via USB or PXE using a traditional BIOS bootloader rather than UEFI, but UEFI is fully supported so it should work.
To boot over USB, simply run make usb drive=sdc, in which sdc is the device node for the USB disk itself (not a partition like sdc2) to which you want to write the OS image.
On WSL or other host environments wh