Can you write an OS Kernel in Go?
summary
Argues that Go can run at ring‑0 and demonstrates a working 32-bit x86 ring‑0 HelloWorld and running demos inside QEMU/VirtualBox. Uses cross‑compilation, GRUB bootloader, GNU ld linker script and NASM assembly to set stack, GS TLS and enable SSE, then runs Go code that writes directly to the 80×25 text framebuffer. Uses objcopy to globalize symbols, preserves go build artifacts with -x and -work, and shows a ray‑marcher (93 LOC) that runs without triggering the Go allocator; maps/interfaces/goroutines stay unavailable until the allocator is bootstrapped.
AI-written summary · about
chapters (18)
- 0:00Intro
- 0:38A little bit of theory ring-based security
- 1:40Running Go applications at Ring-o
- 6:36Let's build something simple
- 8:09How do we load our kernel to memory?
- 9:57How does a linker script look like?
- 11:05The kernel is loaded to memory, what's next?
- 13:00Accessing memory
- 14:01What happens when a Go function runs?
- 16:00Slack growth check: behind the scenes
- 18:51Bootstrap code: allocate stack and initializeg
- 19:59Overriding the Go build process
- 20:59Let's automate the work!
- 23:37Linking the final kernel image
- 24:49Screen output without an OS
- 26:22Before we begin coding: limitations
- 33:15How to overcome these limitations
- 37:00Final remarks








