Repository navigation
How to Build and Run
This guide explains how to compile and run keonOS in a virtual machine, or on real hardware.
- Operating System: Linux or WSL recommended
- Compiler: a g++/gcc cross compiler for x64 ELF with C++17 support
-
Assembler:
nasmrecommended, butyasmcan also be used -
Build tools:
make(OSDev standard), butninjaor other build systems work too - QEMU (or another x86_64 emulator) for testing, such as VirtualBox or VMware
Optional but recommended:
-
GDBfor debugging
git clone https://github.com/fmdxp/keonOS.git
cd keonOSNow you've got the repository on your PC.
As of version 0.4, the kernel and ISO are built in different steps:
- Build the kernel:
makeThis compiles all the kernel source files (.cpp and .asm) into object files and links them into the final kernel.bin.
- Build the ISO:
make isoThis step prepares the bootable ISO using GRUB and includes the initial RAM disk (initrd.img).
The Makefile automates compilation and ISO creation. Key points:
-
CCโ cross-compiler for x64 ELF -
LDโ linker -
ASMโ assembler (nasm) -
CFLAGSandASMFLAGSโ configure compilation for kernel mode - Object files are stored in
build/following the same folder structure as the source -
kernel.binโ compiled kernel in the root ofbuild/ -
iso/โ contains the necessary files for GRUB to create the ISO -
initrd.imgโ initial RAM disk packed via Python script -
HDA_IMGโ FAT32 disk image with a basicreadme.txt
After building, you will have:
-
build/โ contains all.ofiles andkernel.bin -
iso/โ contains GRUB configuration and files required to create the ISO -
keonOS.isoโ the bootable ISO generated aftermake iso -
harddisk.imgโ the system's FAT32 disk image
The keonOS Makefile already provvides a fast way to test and run the OS by running:
make runThis command uses QEMU as a backend to:
- Boot the ISO
- Attach the FAT32 hard disk
- Display serial output in your terminal
- Allocate 512 MB RAM for the VM
Optionally, you could modify QEMU options to adjust memory, CPU cores, or enable debugging.
If unexpected behavior occurs, debugging is useful. GDB comes in handy:
- Start QEMU in debug mode.
qemu-system-x86_64 -kernel build/kernel.bin -S -sYou can add custom settings like memory or CPU cores here too.
- Connect GDB
gdb build/kernel.elf
target remote :1234You can now step through kernel code, inspect memory, and debug low-level issues.
Note: The keonOS Makefile includes debug symbols with each release to make debugging easier.
- Keep dependencies installed and updated
- The OS is under active development; build instructions may change
- Testing in a VM is safer than on real hardware
- Clean your build environment regularly to avoid old object files causing errors
Tip: This page is meant to guide developers and contributors in setting up keonOS. Follow each step carefully for a successful build and run.