Basic Rust kernel using Limine

Overview

Rust Limine Barebones

This is a small kernel that boots using Limine.

Build

First of all, download Rust ! (I guess you already did it if you are here lol) Then, do the following things

# Installs the nightly toolchain, needed for few things
rustup install nightly
cd rust_limine_barebones
# Sets the nightly toolchain as the version of the project 
rustup override set nightly
# Installs cargo xbuild. Needed to build core for our custom target
cargo install cargo-xbuild

This kernel needs echfs-utils for building the image that we can pass through qemu, you can found this here

Scripts

Because I'm a good guy I made many scripts to help you build the kernel. So in order we have:

  • build.sh, builds the kernel. As we use Limine we can let it build a typical ELF executable.
  • build_limine.sh, takes the kernel and pack it with limine in a echfs image.
  • run_qemu.sh, runs the image generated with build_limine.sh. Now you are ready for many hours of suffering with the x86 arch.
  • run_update.sh, launchs every scripts in the order of this list. It aswell deletes the previous image. But still be careful about your compile errors, I don't handle these.

The target

Maybe I've put some unused gcc linking args but if you want your target working instantly just basically copy it.

The linking script

Because the #[used] proc macro isn't enough to keep the stivale2hdr alive after linking you need the linker.ld script to keep it breathing. Without this Limine won't boot your kernel because of missing stivale2hdr section.

Limine config

Limine config is pretty simple but if your kernel is making some progress you maybe gonna need a ramfs.

Resources

If you need anything more than what this repo can offer you, here are some links that may be useful:

Comments
  • License?

    License?

    Hello!

    I'd like to use this as a starting point for my own hobby OS, but I legally can't right now, since you don't have a license listed. Could you set one?

    Thank you!

    opened by rdrpenguin04 3
  • Stivale crate repository does not exist

    Stivale crate repository does not exist

    The https://github.com/Andy-Python-Programmer/stivale-rs repository is unavailable, I guess it moved to https://github.com/Andy-Python-Programmer/stivale.

    opened by Wafelack 1
  • Switch to using the published version of stivale-rs

    Switch to using the published version of stivale-rs

    • Switch to using the crates.io version of stivale-rs (https://github.com/Andy-Python-Programmer/stivale). The crate has been published as stivale-boot
    • The crate has been fully rewritten and now supports all of the structures in the stivale specification so, also includes changes to that

    Signed By: Anhad Singh

    opened by Andy-Python-Programmer 0
  • The stivale repsitory has been renamed

    The stivale repsitory has been renamed

    • The stivale repository has been renamed from https://github.com/Andy-Python-Programmer/stivale-rs to https://github.com/Andy-Python-Programmer/stivale
    • Remove unused use in main.rs

    Fixes: #1

    Signed By: Anhad Singh

    opened by Andy-Python-Programmer 0
  • Limine bootloader error

    Limine bootloader error

    Limine bootloader fails to load the elf file generated.

    I get the following errors:

    1. On limine latest binary (as of today)
    Elf error: Failed to allocate memory ranges
    
    1. On v2.24:
    Elf64: Load Failure
    

    Maybe did you miss any flags? Or is it the fault of limine bootloader?

    opened by Narasimha1997 1
Owner
Quentincestino
19yo student, Rust and microkernels enthusiast
Quentincestino
A tiny 32 bit kernel written in Rust

rustboot A tiny 32 bit kernel written in Rust. I was inspired to download Rust and try to do this after seeing zero.rs - a stub that lets Rust program

Charlie Somerville 1.5k Dec 30, 2022
Experimental kernel for embedded devices written in Rust

bkernel is an experimental kernel for embedded devices written in Rust. I'm mostly trying out Rust now to see how it applies to kernel development. Pr

Alexey Shmalko 84 Dec 13, 2022
Open Source Rust kernel; Runs WASM and WASI as lightweight containers.

?? etheryal Kernel etheryal kernel is an Open Source capability-based Kernel written in the Rust programming language. The kernel allows implementing

null 32 Dec 4, 2022
A new operating system kernel with Linux binary compatibility written in Rust.

Kerla Kerla is a monolithic operating system kernel from scratch in Rust which aims to be compatible with the Linux ABI, that is, runs Linux binaries

Seiya Nuta 3.1k Jan 1, 2023
Minimal x86_64 OS kernel written in Rust

rkernel A minimal x86_64 Rust OS kernel. Multiboot2 VGA driver PIC PIT PS/2 Keyboard driver PS/2 Mouse driver TSC RTC Allocator ATA PIO (In progress..

Divy Srivastava 36 Apr 26, 2022
🍒 Small, simple, and fast kernel written in Rust. 🌸

?? Small, simple, and fast kernel written in Rust. ??

Cherry Developers 5 May 20, 2022
Examples on how to write Windows kernel drivers in Rust

windows-kernel-rs Note: this is still work in progress! This is a Windows kernel framework in Rust that consists of windows-kernel-sys, a crate that p

S.J.R. van Schaik 77 Dec 28, 2022
Xrs is a POSIX-subset operating system kernel written in Rust.

XRS-OS ( ?? WIP) Xrs is a POSIX-subset operating system kernel written in Rust. Current project team members 0x5459 core developer (he/him) 0x5457 cor

null 7 Nov 16, 2022
Linux kernel modules written in Rust

Linux kernel modules written in Rust A collection of in-progress experimental Linux kernel modules written for the Rust for Linux project To run the o

Milan 10 Nov 13, 2022
Rux - An x86_64 toy operating system kernel written in Rust

Rux - An x86_64 toy operating system kernel written in Rust. Rux is a port of the Hux kernel, my x86 32-bit single-CPU toy kernel written in C, following the OSTEP book structure and terminology.

Guanzhou Jose Hu 6 Feb 26, 2022
An super minimal kernel written in rust

Grisha This project depends on this blog serie Philipp Oppermann's blog Required Knowlege I don't know what you really need to know to learn efficient

Ismail Ait Bella 3 Feb 3, 2022
An x86-64 kernel with ~100% Rust (originally) in a week

litchi-rs An x86-64 kernel with ~100% Rust (originally) in a week. The continuation of Litchi. Try it Make sure the Rust toolchains and qemu-system-x8

Bugen Zhao 38 Oct 11, 2022
Linux ABI-compatible kernel written in Rust

Linux ABI-compatible kernel written in Rust ??️ Screenshot (v0.1.0-alpha.1) ?? Build dependencies To compile GalaxyOS kernel and create basic OS ISO i

Krzysztof Stefańczyk 3 Dec 5, 2022
Kernel density estimation in Rust.

kernel-density-estimation Kernel density estimation in Rust. Kernel density estimation (KDE) is a non-parametric method to estimate the probability de

Seaton Ullberg 16 Jan 16, 2023
💻 An x86_64 kernel in the works

BruhOS a basic x86_64 kernel in the works. cool stuff written in rust boots with any stivale2-compliant bootloader framebuffer bitmap font renderer pm

Safin Singh 9 Jun 8, 2021
The official kernel for Popcorn OS, and operating system designed for handheld devices.

About Popkern is the kernel for Popcorn OS, an operating system designed for handheld devices. As such, the kernel is (to be) optimised at all levels

Team Scena 3 Sep 19, 2021
The kernel for LibertyOS.

This is the official repository of the LibertyOS kernel. LibertyOS is an operating system, built with Rust, that is open-source, free-to-use, and open to new contributors.

null 229 Dec 5, 2022
A custom kernel for educational reasons

A custom kernel for educational reasons

TornaxO7 16 Dec 25, 2022
Library for loading Linux kernel modules.

liblmod - Library for loading Linux kernel modules Features: modprobe rmmod Example code: extern crate liblmod; fn main() -> std::io::Result<()> {

Zapomnij 2 Aug 2, 2022