This guide walks you through cloning the NKLegacy repository, installing the required toolchain, compiling the kernel and NKBootman bootloader, assembling the disk image, and finally booting the whole system inside QEMU. By the end you will see the NT-style boot banner in your terminal and land at an interactiveDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pastaboy12345/NKLegacy/llms.txt
Use this file to discover all available pages before exploring further.
C:\> prompt — all running on bare-metal emulated x86 hardware.
Prerequisites and build steps
Install prerequisites
You need a 32-bit–capable GCC cross toolchain, NASM, GNU ld, GRUB rescue tools, and QEMU.On Debian or Ubuntu:Verify the key tools are available:
Build everything
A single top-level target compiles the kernel, assembles both bootloader stages, and produces the floppy disk image:This runs three sub-targets in order:
After a successful build you will have:
| Sub-target | What it does |
|---|---|
kernel | Compiles all C sources and assembles boot.asm/isr.asm into ELF objects, then links them with ntoskrnl/linker.ld to produce build/nklegacy.elf (loaded at 0x100000). |
bootloader | Assembles boot/stage1/mbr.asm → build/boot/mbr.bin (flat binary, 512 bytes) and boot/stage2/stage2.asm → build/boot/stage2.bin (flat binary). |
image | Flattens build/nklegacy.elf to build/nklegacy.bin, creates a 1.44 MB floppy image (build/nklegacy.img), writes the MBR to sector 0, Stage 2 to sectors 1–16, and the kernel binary starting at sector 17. |
Run via GRUB ISO (recommended)
make iso, which:- Creates
build/iso/boot/grub/grub.cfgwith a singleNKLegacymenu entry usingmultiboot. - Calls
grub-mkrescueto producebuild/nklegacy.iso.
-serial stdio flag mirrors COM1 output to your terminal. You should see the serial debug log appear immediately before the VGA window opens.Run via NKBootman floppy
To exercise the custom two-stage bootloader instead of GRUB:This launches:QEMU boots from the 1.44 MB floppy image. The MBR loads Stage 2, which switches to protected mode and jumps to the kernel at 0x100000.
Expected boot output
A successful boot produces the following on the VGA console (and mirrored to serial):help and press Enter to list all available commands.
Cleaning build artifacts
build/ directory, including all object files, binaries, and disk images.