Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luickk/zigkernel
Very basic kernel written in Zig
https://github.com/luickk/zigkernel
Last synced: about 10 hours ago
JSON representation
Very basic kernel written in Zig
- Host: GitHub
- URL: https://github.com/luickk/zigkernel
- Owner: luickk
- Created: 2022-05-26T08:06:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-09T09:55:49.000Z (about 2 years ago)
- Last Synced: 2023-03-07T14:54:26.351Z (over 1 year ago)
- Language: Zig
- Size: 841 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minimal Bare Metal Zig Kernel for aarch64
Very basic aarch64 kernel written in Zig.
# Status
I started this project with the goal of writing a simple kernel with a few drivers (in zig). Since Zig is not completely stable (yet; on aarch64), I found a few issues and quirks one of which is a compiler bug.
The compiler bug is an issue with struct returns, that is not resolved yet. It's not a dealbreaker though, since one can maneuver around that quite easily.
I posted that issue on Zigs git with a complete description of the observed behaviour and hypothesis: https://github.com/ziglang/zig/issues/11859.
For debugging purposes I implemented the ramfb driver in C as well(which helped me to resolve the issue): https://github.com/luickk/qemu-ramfb-aarch64-driver and the arm a53 interrupt controller gicv2: https://github.com/luickk/zig-gicv2.As up to now, depending on the build mode (more on that in the gh issue), the kernel either runs fine & the ramfb driver works or it doesn't boot.
## Setup
### Dependencies
- qemu-system-aarch64
- zigTo build the kernel just run
`zig build` and to emulate it,
`zig build emulate-serial`## Ramfb (simple virtual display)
The driver can be found [here](https://github.com/luickk/qemu-ramfb-aarch64-driver) (my C implementation)
## Manual Build Scripts (deprecated)
### Dependencies
- aarch64-linux-gnu-gcc
- aarch64-linux-gnu-ld
- qemu-system-aarch64
- zigThe manual build can be found in `build_scripts/` and consists of the necessary build scripts for a standarad aarch64 virtual machine. Just run `build_toolchain.sh` as well as `run_qemu.sh` to test the kernel.
A full implementation using the zig builder is in process.
## Demo
![demonstration](media/demo.png)