Booted my first kernel today. It’s just a black screen with a white “F” in the corner, but it’s my black screen with my white “F”, printed by code I wrote, with no OS underneath.
What I built
-
A cross-compiler from source.
i686-elf-gccdoesn’t exist on a normal Linux install, you build it yourself from binutils + gcc source, targeting a “fake” freestanding platform (no OS, no libc assumed).
I wrote the whole build script in bash, which I’d genuinely never written before this project. -
A Multiboot2 header (
boot.s, NASM assembly) the exact magic number, checksum, and end tag GRUB looks for to recognize a bootable kernel. Also set up a stack (the CPU doesn’t give you one for free) and the_startentry point that hands off from assembly into C. -
A linker script (
linker.ld) that tells the linker to load the kernel at 1MB — the first chunk of physical memory not already claimed by legacy BIOS/VGA stuff. -
kernel.c— writes directly to the VGA text buffer at physical address0xB8000(2 bytes per character: ASCII + color attribute). Noprintf, no stdlib, just a raw pointer and a cast.
Look forward for the next steps
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.