ARMv8-A/RISC-V kernel (with UEFI bootloader)
This repository has been archived on 2024-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Asherah Connor 16b5c84dcb roms: update opensbi 2023-04-16 19:39:31 +10:00
common zig master 2023-03-11 11:12:42 +11:00
dainboot roms: update riscv64 u-boot, opensbi 2023-04-16 11:57:00 +10:00
dainkrnl riscv: getting to main again 2023-04-16 19:39:31 +10:00
doc/img cont readme 2021-03-02 21:30:41 +11:00
dtb@f8b0e18c1a zig fmt 2023-03-11 11:10:17 +11:00
roms roms: update opensbi 2023-04-16 19:39:31 +10:00
tools ci-expect-arm64: add back ovmf_vars 2023-04-16 01:58:02 +00:00
.gitignore latest zig 2021-05-05 15:52:03 +10:00
.gitmodules dtb in submodule 2021-02-10 16:20:50 +11:00
CODE_OF_CONDUCT.md add CoC 2021-03-16 17:30:27 +11:00
LICENSE version 2021-01-13 14:24:12 +11:00
Makefile roms: update arm64 u-boot, add back ovmf_vars.fd 2023-04-16 11:57:00 +10:00
README.md license: clarify 2021-03-23 13:41:11 +11:00
daintree.code-workspace dainboot: building 2023-02-08 21:18:49 +11:00
debug.sh rename os -> dainkrnl 2021-03-02 20:15:34 +11:00
objdump.sh wip-index 2023-03-10 19:30:05 +11:00

daintree

An operating system plus a UEFI bootloader, all written in Zig. Currently targetting and testing on:

  • QEMU (arm64 + riscv64) with U-Boot
  • ROCKPro64 (arm64) with U-Boot
    • A mainline build is okay, but it must contain this EFI loader fix. At time of writing it has not been included in any release.

Planned support for:

  • HiFive Unmatched with U-Boot

There's a little dev blog I hope to maintain as I go. See also my personal blog:

dainboot

A gentle introduction to Zig's UEFI support. Boots like this:

  • Checks loaded image options.
    • You can pass kernel 0x12345678 0x1234 to give it the location of the kernel already loaded in RAM. Useful for TFTP boot, which itself is handy for faster development cycles on bare metal.
    • You may also pass dtb 0x12345678 0x1234 to give information about a DTB/FDT (device tree blob/flattened device tree) already in memory.
    • Separate successive options with spaces, i.e. kernel <addr> <len> dtb <addr> <len>.
  • If DTB wasn't loaded from memory, checks to see if one was passed in via UEFI.
  • If kernel or DTB (or both) were not loaded from memory, scans filesystems the UEFI system knows about, looking in the root directories for files named dainkrnl and dtb.
  • Picks the biggest unused slab of conventional memory and places the kernel there.
  • Clears data and instruction caches for loaded memory.
  • Parses the DTB and attempts to locate the serial UART port.
  • Exits UEFI boot services.
  • If necessary, disables a whole lot of traps and goes to EL1.
  • Jumps to the kernel, passing the memory map, UART write port, and framebuffer prepared by UEFI.

dainkrnl

  • Uses the UART write port to debug before the MMU is enabled.
  • Sets up the MMU, mapping the kernel, stack, framebuffer, DTB, UART device, etc. into high addresses.
  • Parses the DTB to understand what kind of serial device is connected and how to access PSCI.
  • Implements a console using a classic VGA font.
  • A shell lets you reset or poweroff the system. You can only use serial for input, but the output is muxed to the framebuffer if one is available.

license

MIT.

Some included binaries are GPL-2+ or GPL-2.0+ -- copyright notices retained and sources noted where so.

The roms/ directory contains an arm64 build of U-Boot, (C) Wolfgang Denk and licensed under GPL 2. See U-Boot's Licensing page for details. The source can be found at https://git.src.kameliya.ee/~kameliya/u-boot/log/qfw-ramfb.

It also contains a riscv64 build of same at https://git.src.kameliya.ee/~kameliya/u-boot/log/qfw-ramfb-riscv. It is embedded in a build of OpenSBI, (C) 2019 Western Digital Corporation, licensed under BSD-2-Clause.