2024-03-13 02:17:12 +02:00
|
|
|
yggdrasil-kernel
|
|
|
|
================
|
|
|
|
|
|
|
|
Rust Unix-like operating system.
|
|
|
|
|
2024-03-13 02:21:21 +02:00
|
|
|

|
|
|
|
|
2024-03-13 02:17:12 +02:00
|
|
|
Main features
|
|
|
|
-------------
|
|
|
|
|
|
|
|
* Architecture support: [aarch64](/kernel/src/arch/aarch64) and [x86_64](/kernel/src/arch/x86_64)
|
|
|
|
* Kernel/userspace preemptive multithreading
|
|
|
|
* Kernel-space multitasking with `async`/`await` runtime
|
|
|
|
* Symmetric Multiprocessing
|
|
|
|
* Unix-like virtual filesystem:
|
|
|
|
files, directories, block/char devices, symlinks, mounts
|
|
|
|
* [Kernel-user ABI](/lib/abi-def/yggdrasil.abi) generated from a rust-like description language
|
|
|
|
* In-memory read-write filesystem for tar-based initrd
|
|
|
|
* sysfs/devfs
|
|
|
|
* Binary formats: ELF + `#!/...` shebangs
|
|
|
|
* Rust-style interfaces for most of the stuff like memory management, devices etc.
|
|
|
|
* PCI Express devices
|
|
|
|
* NVMe drive support (read/write, currently x86_64 only, due to lack of MSI-X support on aarch64).
|
|
|
|
* AHCI SATA drive support (read/write)
|
|
|
|
* xHCI USB host controller
|
|
|
|
* USB HID keyboards
|
|
|
|
|
|
|
|
aarch64-specific:
|
|
|
|
|
|
|
|
* PSCI for SMP start-up and power control
|
|
|
|
* PL011 serial port
|
|
|
|
* ARM generic timer as system/monotonic timer
|
|
|
|
* GICv2 IRQ controller
|
|
|
|
|
|
|
|
x86_64-specific:
|
|
|
|
|
|
|
|
* UEFI boot through [yboot](https://git.alnyan.me/yggdrasil/yboot)
|
|
|
|
(no plans for legacy boot)
|
|
|
|
* I/O and Local APIC IRQ controllers
|
|
|
|
* PS/2 keyboard
|
|
|
|
* i8253-based timer (got some problems with HPET on
|
|
|
|
real hw, had to revert, lol)
|
|
|
|
* COM ports
|
|
|
|
* ACPI, [work in progress](https://github.com/rust-osdev/acpi), mostly broken
|
|
|
|
on real hardware
|
|
|
|
* ACPI shutdown
|
|
|
|
* PCI IRQ pin routing
|
|
|
|
* Events like power button, etc.
|
|
|
|
* Fancy framebuffer console
|
|
|
|
|
|
|
|
Userspace features:
|
|
|
|
|
|
|
|
* Sanitized system calls better suited for Rust
|
|
|
|
* Userspace threads
|
|
|
|
* Synchronization primitives through futex-like interface
|
|
|
|
* Unix-like signals and exceptions
|
|
|
|
|
|
|
|
Building the OS
|
|
|
|
---------------
|
|
|
|
|
|
|
|
Prerequisites:
|
|
|
|
|
|
|
|
* Decent CPU and a sizable amount of RAM
|
|
|
|
* ~20G of free disk space
|
|
|
|
* Patience
|
|
|
|
|
|
|
|
**NOTE** Full OS build requires you to build the `*-unknown-yggdrasil`
|
|
|
|
Rust toolchain, which may take quite a while, so be prepared.
|
|
|
|
|
|
|
|
Steps:
|
|
|
|
|
|
|
|
0. Install the prerequisite software
|
|
|
|
|
|
|
|
```bash
|
|
|
|
### For Arch Linux based systems
|
|
|
|
|
|
|
|
# pacman -Sy cmake ninja llvm dosfstools mtools
|
|
|
|
|
|
|
|
### For MacOS
|
|
|
|
|
|
|
|
$ brew install cmake ninja llvm dosfstools mtools
|
|
|
|
$ export PATH="$PATH:/opt/homebrew/Cellar/llvm/.../bin"
|
|
|
|
```
|
|
|
|
|
|
|
|
**NOTE** Nightly Rust version and rustup are required, for details see
|
|
|
|
the [rustup page](https://rustup.rs/).
|
|
|
|
|
|
|
|
1. Clone this repo
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ git clone https://git.alnyan.me/alnyan/yggdrasil
|
|
|
|
$ cd yggdrasil
|
|
|
|
# Optionally, checkout a release/snapshot branch
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Run `cargo xtask toolchain` to fetch, build and link the toolchain
|
|
|
|
3. Run `cargo xtask` to build the OS.
|
|
|
|
|
|
|
|
Once the OS has been built, you can run it in QEMU by executing
|
|
|
|
`cargo xtask qemu`. For more `xtask` commands, see `cargo xtask --help`.
|
|
|
|
|
|
|
|
General plans (in no particular order)
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
* Better unification of architecture code
|
|
|
|
* `async` for VFS (?)
|
|
|
|
* Code cleanup, I've been doing quite a lazy job at that lately...
|
|
|
|
|
|
|
|
Navigation
|
|
|
|
----------
|
|
|
|
|
|
|
|
* Kernel: [`/kernel`](/kernel)
|
|
|
|
* Userspace: [`/userspace`](/userspace)
|
|
|
|
* ABI definitions: [`/lib/abi-def`](/lib/abi-def)
|