Skip to content

luickk/ZigKernel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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: ziglang/zig#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
  • zig

To 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 (my C implementation)

Manual Build Scripts (deprecated)

Dependencies

  • aarch64-linux-gnu-gcc
  • aarch64-linux-gnu-ld
  • qemu-system-aarch64
  • zig

The 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

About

Very basic kernel written in Zig

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages