一个使用 Go 编写的 64 位独立操作系统内核,通过 GRUB/Multiboot2 开机,具有 VGA 终端、PS/2 键盘、IDT/PIC/PIT、调试 shell、位图页框架等。
一个使用 Go 编写的 64 位独立操作系统内核,通过 GRUB/Multiboot2 开机,具有 VGA 终端、PS/2 键盘、IDT/PIC/PIT、调试 shell、位图页框架等。
Hobby project to dig deeper into how an OS works by writing the bare essentials of a kernel in Go. Only the kernel lives here (gccgo, x86_64 long mode); BIOS and bootloader are handled by battle-tested tools (GRUB with a Multiboot2 header). No reinvention of those pieces. Join Discord for real time discussions on the project !
Starting with v0.5.0, go-dav-os includes its first Minimum Working Agent: a small, inspectable runtime that turns user intent into typed actions instead of arbitrary shell commands.
The current Agent foundation includes:
agent subcommands directly to typed actions;The trust boundary is deliberate: an LLM may propose one allowed typed action, but the OS remains responsible for validation, confirmation and execution. v0.5.0 establishes this secure foundation. The real QEMU guest-to-host transport and an OpenAI-compatible provider are planned for v0.6.0; provider credentials will remain outside the guest and kernel.
write notes hi
agent show files
agent read notes
agent delete notes
yes
agent context
agent modeRead the Agent runtime architecture, LLM bridge protocol and fake bridge guide.
Agent runtime: agent/ implements typed planning, validation, safety, constrained execution, context and LLM bridge contracts
Boot: boot/boot.s exposes the Multiboot2 header and _start, sets up a 16 KB stack, enables long mode, and jumps into kernel.Main
kernel.Main(...) in RDIboot/ as well (minimal stubs + memcmp to keep the build libc-free)Kernel: kernel/ in Go, freestanding build with gccgo
hlt-based idle loop when there’s no inputTerminal: terminal/ writes to VGA text mode 80x25, manages cursor, scroll, and backspace
Keyboard: keyboard/ reads from PS/2 and supports both Italian (it) and US (us) layouts. Switch at runtime with the layout command.
Tiny shell: interactive prompt + basic line editing, commands are mostly for debugging
Memory: mem/
mmap and mmapmax commands)pfa/alloc/free)Filesystem: fs/
ls/write/cat/rm/stat)Persistent Storage: drivers/ata + fs/fat16
Full manual: https://dmarro89.github.io/go-dav-os/
--platform=linux/amd64x86_64-elf-{binutils,gccgo}, grub-mkrescue, xorriso, mtools, qemu-system-x86_64docker build --platform=linux/amd64 -t go-dav-os-toolchain .
docker run --rm --platform=linux/amd64 \
-v "$PWD":/work -w /work go-dav-os-toolchain \
make # builds build/dav-go-os.iso
qemu-system-x86_64 -cdrom build/dav-go-os.isoQuick targets from the Makefile
make docker-build-only builds the image and the ISOmake run (outside Docker) runs QEMU on an existing ISOAssuming an x86_64-elf-* toolchain is installed
make
qemu-system-x86_64 -cdrom build/dav-go-os.isoTo force cross binaries: make CROSS=x86_64-elf
If you run into issues while building or running the project, check these common pitfalls:
command not found: x86_64-elf-as or x86_64-elf-gccgo: Your cross-compiler toolchain is missing or not in your $PATH. You must build/install an x86_64-elf toolchain natively.grub-mkrescue errors): The build requires grub-mkrescue, xorriso, and mtools to pack the ISO. Install them via your package manager (e.g., apt install grub-common grub-pc-bin xorriso mtools).qemu-system-x86_64 is installed (usually part of the qemu-system-x86 package). If QEMU fails to launch a display, ensure your host supports graphical windows.When in doubt, use the Docker workflow! It is the recommended path and pre-packages all necessary build dependencies. Just ensure your Docker platform is set to linux/amd64 (especially important on Apple Silicon Macs).
> shows uphelp lists commands, clear wipes the screenhlt when nothing is happeninghelp, clear, echo, version, historyticks (PIT tick counter)mem [len] (hexdump)mmap, mmapmax (Multiboot memory map and highest usable end)pfa, alloc, free (page allocator)ls, write , cat , rm , stat (in-memory filesystem)run (task runner)agent [arg] (typed Agent runtime)fatformat - Initialize disk with FAT16 structurefatinit - Mount the filesystemfatinfo - Show filesystem layoutfatls - List files in root directoryfatcreate - Create a filefatread - Read a file disk read|write - Raw sector accessExample:
fatformat
fatinit
fatcreate hello Hello World
fatls
fatread helloThe task runner can start small assembly programs linked into the kernel. At the moment, the supported launch names are:
run hellorun kread (ring3 read probe against kernel memory, should page-fault)run kwrite (ring3 write probe against kernel memory, should page-fault)run hello starts user/hello.s, which enters the kernel via syscall, calls SYS_WRITE, and then SYS_EXIT.
Example:
run helloThe current command list (from shell/shell.go) is:
Commands: help, clear, echo, ticks, uptime, mem, mmap, pfa, alloc, free, ls, write, cat, rm, stat, version, history, run, disk, fatinit, fatformat, fatinfo, fatls, fatcreate, fatread, layoutiso/: GRUB config and ISO packaging bits (grub.cfg)boot/: also contains the linker script (linker.ld) and a couple of freestanding helpers used by the buildbuild/: build output (ISO + ELF)Contributions are welcome! This project is still early-stage and intentionally minimal, so small PRs are the best way to help.
good first issue or help wantedPersonal, open-source, work-in-progress. I’m building pieces as I learn them—the goal is understanding, not chasing modern-OS feature lists
暂无开放 Issues,或尚未同步最近议题。