A 64-bit x86 operating-system kernel, written from scratch in C and assembly, that boots into its own interactive shell.
Nutshell is a small operating-system kernel built the hard way: no libc, no framework, no training wheels. GRUB drops us into 32-bit protected mode; from there the kernel sets up its own page tables, enters 64-bit long mode, installs interrupt handlers, drives the keyboard, manages physical memory, and finally boots into a shell running on the bare metal: no OS underneath it, because this is the OS.
It is deliberately scoped: enough to be real, small enough for one person to understand end to end.
GRUB loads the Multiboot2 image, the 32-bit entry creates the first page tables and enables long mode, and a far jump hands control to the 64-bit C kernel. The kernel then brings up its runtime GDT/TSS, allocators, interrupts, timer, and keyboard before entering the shell. The complete annotated path is in docs/03-boot-process.md.
+-----------+ GRUB +------------------+ long mode +----------------+
| BIOS / | --------> | boot.asm (32b) | ----------> | kernel (C,64b)|
| GRUB | multiboot2| paging + GDT + | far jump | VGA, IDT, PIC |
+-----------+ | long-mode enter | | keyboard, mem |
+------------------+ | -> shell |
+----------------+
- The 32 → 64-bit transition, by hand: CPUID feature detection, building
4-level page tables, enabling PAE +
EFER.LME+ paging, and far-jumping through a 64-bit GDT. (docs/03-boot-process.md) - Interrupts from the silicon up: a 64-bit IDT, remapping the legacy 8259 PIC, exception and IRQ handlers, and the PIT timer. (docs/06-interrupts.md)
- Your own memory manager: a physical-frame allocator over the multiboot
memory map and a kernel heap, so
mallocmeans yourmalloc. (docs/05-memory-management.md) - A real driver: PS/2 keyboard on IRQ1, scancode-set-1 decoding, and an input ring buffer feeding the shell. (docs/07-keyboard-and-drivers.md)
- A shell on bare metal: a REPL with built-in commands, running with nothing beneath it. (docs/08-the-shell.md)
The panic built-in deliberately raises a divide error so the exception path
can report the vector and register state instead of silently rebooting.
./scripts/setup-wsl.sh # one-time: nasm, gcc, binutils, grub, qemu
make run # build the ISO and boot Nutshell in QEMU
make test # run PMM, heap, and scripted-shell tests in QEMU
make test-host # fast memory-map regressions, GCC only
make test-interactive # real PS/2 typing, editing, recovery, and fault testsYou should see Nutshell boot into 64-bit long mode and print its banner. Serial output is mirrored to your terminal. See docs/01-getting-started.md for details, and docs/09-testing-and-debugging.md for the QEMU + GDB workflow.
Nutshell builds on Ubuntu or WSL2 with nasm, GCC, GNU binutils, make,
xorriso, GRUB rescue tools, mtools, and qemu-system-x86_64. The host must
be x86-64. No graphical display is required: the build and self-test workflows
use QEMU serial output as their source of truth.
Nutshell v1.0.0 is complete. The kernel boots to nutshell> , all built-in
commands work, and CI smoke-boots both the interactive and self-test images.
| # | Milestone | State |
|---|---|---|
| 0 | Boot to 64-bit long mode | ✅ done |
| 1 | Screen + serial I/O (kprintf) |
✅ done |
| 2 | Global Descriptor Table | ✅ done |
| 3 | Interrupts (IDT + PIC + timer) | ✅ done |
| 4 | PS/2 keyboard driver | ✅ done |
| 5 | Physical memory + kernel heap | ✅ done |
| 6 | The shell | ✅ done |
| 7 | Polish, tests, portfolio pass | ✅ done |
Nutshell currently targets BIOS boot through GRUB on x86-64. It uses VGA text mode, PS/2 keyboard input, identity-mapped low memory, and a single CPU core. There is no userspace, privilege separation, filesystem, networking, USB, ACPI enumeration, or SMP support. These boundaries keep the complete boot, interrupt, memory, driver, and shell path small enough to understand end to end.
nutshell/
├── boot/ # assembly: multiboot header, 32->64-bit bring-up
├── src/ # C kernel sources (auto-discovered by the Makefile)
├── include/ # kernel headers
├── assets/ # real QEMU boot GIF and fault screenshot
├── grub/ # GRUB config baked into the ISO
├── scripts/ # toolchain setup and helpers
├── tests/ # headless QEMU self-test runner
├── docs/ # architecture, boot process, roadmap, milestones, ADRs
├── linker.ld # places the multiboot header first; loads kernel at 1 MiB
└── Makefile # build / iso / run / debug / clean
Everything is in docs/. Start with
docs/00-overview.md, or jump to the
roadmap to see how each piece gets built.
MIT: see LICENSE.

