Skip to content

mematrix/vos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vOS

A RISC-V Operator System written by Rust.

Minimum Supported Rust Version (MSRV)

Some features this project used are still unstable, so a nightly version is required.

  • Min Version: 1.65.0.
    • feature const_ptr_offset_from is stable since 1.65.0.
  • Nightly Version:
    • feature default_alloc_error_handler is unstable. Needed with the custom GlobalAllocator and alloc crate.
    • feature inline_const is unstable. Needed on the custom impl of offset_of! macro.

Build

  1. Make sure the rust version meets the minimum requirements.
  2. Make sure the RISC-V target has been installed.
    # rustup default nightly
    rustup target add riscv64gc-unknown-none-elf
  3. Run cargo build to build the project.

Run

Before the run, make sure the file named hdd.dsk is existed in the project root dir, this file is used in QEMU as the disk device (See QEMU arguments).

A way to create the hdd.dsk file:

dd if=/dev/zero of=hdd.dsk count=32 bs=1M

The simplest way to launch the kernel is using cargo run command, this will use the cargo config in .cargo/config.toml to run with QEMU.

Another way is to launch QEMU manually, for example:

qemu-system-riscv64 -machine virt -cpu rv64 -smp 4 -m 128M -nographic -s -drive if=none,format=raw,file=hdd.dsk,id=foo -device virtio-blk-device,drive=foo -serial mon:stdio -bios none -kernel ./target/riscv64gc-unknown-none-elf/debug/vos

The QEMU arguments can be customized.

QEMU Minimum Version

  • Min Version: 7.1.0.
    • RISC-V privileged spec version 1.12.0 is supported from this version.
    • ChangeLog/7.1

Unfortunately, the current stable QEMU version (7.1.0) does not support the RISC-V SSTC extension, we need to manually build the latest master code to get this extension work. See QEMU Page for build instructions.

License

This project is under the MIT license (LICENSE) and any dependence is using its original license.

About

RISC-V OS, Written in Rust. For study.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published