Files
danos/README.md
T
Daniel Samson 8754d4e46a Re-organize the source tree as a monorepo mirroring the FHS
The source layout now mirrors the runtime filesystem hierarchy
(docs/danos-file-system-hierarchy-FSH.md): what lives under system/ in the
source is what a running danos represents under /system. Each service and
driver is a sub-project directory that is its own Zig module — cross-project
references go by module name, never by a path into another project's files.

Moves (all git mv, history preserved):
- src/            -> system/            (danos internals; the self-representation)
    root.zig      -> danos.zig          (the kernel<->user contract module)
    kernel/arch/  -> kernel/architecture/   (arch -> architecture)
    device/       -> devices/           (what /system/devices reflects)
    boot/         -> /boot              (the loaders, top level)
- sbin/           -> split by role:
    init, vfs     -> system/services/<name>/<name>.zig
    hpetd, busd   -> system/drivers/<name>/<name>.zig
    vfs-test      -> system/services/vfs/vfs-test.zig  (inside the vfs project)
- lib/            -> library/runtime/   (room for other libraries beside runtime)

The VFS wire protocol becomes its own module, system/services/vfs/protocol.zig
("vfs-protocol"): the vfs sub-project exposes its interface, and the runtime's
file layer imports it by name. First instance of the "protocol module" pattern
(docs/driver-model.md); usb/block will expose theirs the same way.

Also: fix a naming-standard violation in the protocol — Op -> Operation (and
req -> request, _pad -> _padding). Docs updated: /system/services added to the
FHS doc, a repository-layout section added to the docs index, and stale source
paths swept across comments and docs.

Runtime boot paths are unchanged (the bootloader still loads /sbin/init);
aligning the runtime filesystem to the FHS is a separate follow-up. Suite 35/35
plus host tests green.
2026-07-10 12:55:56 +01:00

67 lines
2.5 KiB
Markdown

# DanOS
Codename: Shodan
Version: 1
A small operating system, written from scratch in Zig — a bootloader (`boot/`)
and a microkernel (`system/kernel/`), sharing a neutral handoff contract (`system/danos.zig`).
It boots x86-64 via UEFI, and so far has a framebuffer console, a physical frame
allocator, its own paging with W^X permissions, interrupt/exception handling, a
LAPIC timer, a kernel heap, a fixed-priority preemptive scheduler, and in-kernel IPC
channels. See [`docs/`](docs/README.md) for how each piece works.
## Prerequisites
- **Zig 0.16.x** — the build is pinned to this line (`.zig-version`); other minor
versions are rejected, because Zig makes breaking changes between releases
pre-1.0. A toolchain manager such as [zvm](https://github.com/tristanisham/zvm)
or `zigup` will pick up `.zig-version` automatically.
- **QEMU** (`qemu-system-x86_64`) — to run and test the kernel. On macOS,
`brew install qemu` also bundles the OVMF firmware below.
- **OVMF** UEFI firmware — the `edk2-ovmf` package (Arch), `ovmf` (Debian/Ubuntu),
or `edk2-ovmf` (Fedora); on macOS it ships inside the Homebrew `qemu` formula.
Both the build and the test harness probe the known Arch/Debian/Fedora/macOS
layouts and use the first that exists, so no configuration is normally needed.
Override with `-Dovmf-code=` / `-Dovmf-vars=` (build) if yours lives elsewhere.
- **Python 3** — for the QEMU integration test harness.
## Build
```sh
zig build
```
Produces the UEFI bootloader (`zig-out/bin/BOOTX64.efi`) and the kernel ELF
(`zig-out/bin/kernel`).
## Run
Boot it in QEMU with OVMF (opens a display window):
```sh
zig build run-x86-64
# distro with OVMF elsewhere:
zig build run-x86-64 -Dovmf-code=/path/OVMF_CODE.fd -Dovmf-vars=/path/OVMF_VARS.fd
```
## Test
```sh
zig build test # host unit tests (the platform-independent shared code)
python3 test/qemu_test.py # QEMU integration tests: boots the kernel and asserts
# on its serial output (see docs/testing.md)
```
The integration harness builds and boots the kernel once per test case, checking
memory, the frame allocator, paging (incl. NX and the null guard), the heap,
interrupts, and exception handling. It exits non-zero on any failure, so it drops
straight into CI.
## Documentation
Design notes explaining the *why* behind the code live in
[`docs/`](docs/README.md) — start with [`docs/README.md`](docs/README.md).
## Logo
San Serif Text "Dan OS" with a black karate belt around it.