Zesty means we embrace new technology!
Zesty begins with 'Z', which implies we are using Zig
Zesty-Core is a RISC-V kernel written in Zig, aiming to be compatible with POSIX (may not be accomplished).
Currently can only run on QEMU with -machine virt
It currently only have kernel, and only print out some naive strings every second.
It currently don't have any syscall support, and also no userspace development support.
It just don't have userspace!
Hopefully by the time some of the system call is implemented, userspace development can simply use any libc implemention.
- Zig==0.9.0
- OpenSBI>=0.9
Require Zig 0.9.0 Exactly!
Since Zig is still under development, the API of std library is not stablized, so the exact same version of Zig is required.
Since 2021-12-21, Zesty-Core
had migrated to Zig 0.9.0.
Some SBI feature used in the kernel is in SBI v0.3, So OpenSBI v0.9 and above is required.
If you have installed QEMU 6.0.0+, OpenSBI v0.3 is already included.
Currently, this project is tested against:
- QEMU 6.2.0
- GCC 10.2 with target riscv64-unknown-elf
- QEMU -machine virt
zig build // Will build the project into build/
zig build run // Will run the kernel with qemu, must have qemu-system-riscv64 installed
- Zig 0.9.0 (2021-12-21)
- spinlock (2021-12-13)
- std.log and panic support
- UART Driver (2021-12-13)
- initialize using the device tree info
- migrate to OpenSBI (see SBI in this project)
-
console related(SBI v0.1 feature, deprecated in SBI specification v0.2 and above) - shutdown (2021-12-14)
- hardware timer setup
-
- interrupt
- interrupt handler setup (2021-12-14)
- clock interrupt (2021-12-14)
- other interrupt handlers
- physical memory management
- device tree parsing (2021-12-16)
- xv6 alike linklist management (2021-12-16)
- buddy allocator (2021-12-20)
- std.mem.GerneralPurposeAllocator
- 2-stage initial
- pagetable
- initial stage kernel pagetable (2021-12-18)
- enable paging (2021-12-18)
- KPTI, Kernel Page-Table Isolation
- user page table
- proccess
- process structure
- context switching
- hart status management
- smp env setup
- proccess scheduling
- clock interrupt scheduling
- schedule() function
- syscall
- fork
- write
Tools required:
- riscv-gnu-toolchain
- qemu (build with riscv64)
Clone
$ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
Install
$ cd riscv-gnu-toolchain
$ sudo ./configure --prefix=/usr/local
$ sudo make
notice: this will install the toolchain into /usr/local, you can change to install location as you wish, but you will need to add it to you $PATH
mannually.
Download, at least QEMU 6.0.0 is required
$ wget https://download.qemu.org/qemu-6.2.0.tar.xz
$ tar xf qemu-6.2.0.tar.xz
Install
$ cd qemu-6.2.0
$ sudo ./configure --disable-kvm --disable-werror --prefix=/usr/local --target-list="riscv64-softmmu"
$ sudo make
$ sudo make install
$ riscv64-unknown-elf-gcc --version
riscv64-unknown-elf-gcc (GCC) 10.2.0
...
$ qemu-system-riscv64 --version
QEMU emulator version 6.2.0
Ctrl+A and then x, this will terminate QEMU.
- std.log
- @panic
- Some architecture independent datastructure container
Pretty much anything else related to system.
- https://github.com/AndreaOrru/zen
- https://github.com/rcore-os/rCore
- https://github.com/mit-pdos/xv6-riscv xv6 from MIT re-written for RISC-V
src/dtb
is a project from @kivikakk, by the time the code was copied in, the project is licensed under MIT license. All right reserved for @kivikakk.
All other files in this project are licensed under the AGPL-3.0 license.