Bootable x86 kernel built from scratch — KFS-1 and KFS-2 with a freestanding libc.
A toy operating-system kernel built incrementally from the bare bones up. KFS-1 boots from a multiboot-compliant entry and prints to a VGA text terminal; KFS-2 adds GDT + IDT setup, ISR/IRQ handlers, PS/2 keyboard input, an interactive shell, and a freestanding libc with stdio, stdlib, and string implementations. The kernel runs under QEMU using a custom i686-elf cross-compilation toolchain and a reproducible ISO build pipeline.
This project was built as part of the 42 school cybersecurity / kernel track with a partner (Jungmoo Cheon) · KFS-1 score: 116/100, KFS-2 score: 118/100.
| Layer | Technologies |
|---|---|
| Language | C, x86 assembly |
| Toolchain | i686-elf-gcc cross-compiler, GNU binutils |
| Boot | Multiboot, GRUB |
| Build | Bash scripts, linker scripts, Makefiles |
| Run | QEMU (x86) |
- Bootable kernel: multiboot-compliant entry, custom linker script, runs under QEMU and as a GRUB-bootable ISO
- CPU bring-up: GDT setup and IDT with ISR / IRQ handlers (
isrs.S,irqs.S) - VGA text mode: terminal driver with cursor handling, scrolling, and color attributes
- PS/2 keyboard: scancode translation and basic keymap
- Interactive shell: simple in-kernel REPL built on the keyboard + terminal stack
- Freestanding libc: hand-written
stdio,stdlib, andstringimplementations with no external dependencies - Reproducible build pipeline: cross-compile, link, ISO generation, QEMU runner — all script-driven
kfs/
├── kfs/ # current stage (KFS-2)
│ ├── kernel/
│ │ ├── arch/i386/ # arch-specific bring-up
│ │ │ ├── boot.S # multiboot entry
│ │ │ ├── gdt.c # GDT setup
│ │ │ ├── idt.c # IDT setup
│ │ │ ├── isr.c # ISR dispatch
│ │ │ ├── irq.c # IRQ handlers
│ │ │ ├── tty.c # VGA terminal
│ │ │ ├── keyboard.c # PS/2 keyboard
│ │ │ └── io.c # port I/O
│ │ ├── include/
│ │ ├── kernel/
│ │ │ ├── kernel.c # kernel main
│ │ │ └── shell.c # interactive shell
│ │ └── Makefile
│ ├── libc/
│ │ ├── stdio/ # printf, putchar, ...
│ │ ├── stdlib/ # malloc, abort, ...
│ │ ├── string/ # memcpy, strlen, ...
│ │ ├── arch/
│ │ ├── include/
│ │ └── Makefile
│ ├── build.sh # full build
│ ├── iso.sh # ISO generation
│ ├── qemu.sh # run under QEMU
│ └── ... # supporting scripts
├── kfs-1-barebones-backup/ # KFS-1 snapshot
└── kvm/ # KVM-related setup
A POSIX environment with:
i686-elf-gcc # cross-compiler
grub-mkrescue # ISO generation
xorriso # ISO toolkit
qemu-system-i386 # x86 emulatorgit clone https://github.com/sungyongcho/kfs.git
cd kfs/kfs
./build.sh # cross-compile kernel + libc
./iso.sh # produce a bootable ISO
./qemu.sh # run under QEMU- Bare-metal programming: booting an x86 kernel via multiboot, setting up CPU descriptor tables (GDT/IDT), and handling interrupts without an OS underneath.
- Toolchain construction: configuring an
i686-elfcross-compiler and a reproducible build pipeline from scratch. - Freestanding C: implementing the parts of libc (
stdio,stdlib,string) that the kernel needs, with no external dependencies.
This project was built as part of the 42 school curriculum.
Part of sungyongcho's project portfolio.