Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

How to Build and Run

dany edited this page Jan 15, 2026 · 2 revisions

How to Build and Run keonOS ๐Ÿ› ๏ธ

This guide explains how to compile and run keonOS in a virtual machine, or on real hardware.


๐Ÿ”น Requirements

  • Operating System: Linux or WSL recommended
  • Compiler: a g++/gcc cross compiler for x64 ELF with C++17 support
  • Assembler: nasm recommended, but yasm can also be used
  • Build tools: make (OSDev standard), but ninja or other build systems work too
  • QEMU (or another x86_64 emulator) for testing, such as VirtualBox or VMware

Optional but recommended:

  • GDB for debugging

๐Ÿ”น Cloning the Repository

git clone https://github.com/fmdxp/keonOS.git
cd keonOS

Now you've got the repository on your PC.


๐Ÿ”น Building keonOS

As of version 0.4, the kernel and ISO are built in different steps:

  1. Build the kernel:
make

This compiles all the kernel source files (.cpp and .asm) into object files and links them into the final kernel.bin.

  1. Build the ISO:
make iso

This step prepares the bootable ISO using GRUB and includes the initial RAM disk (initrd.img).


๐Ÿ”น Makefile Overview

The Makefile automates compilation and ISO creation. Key points:

  • CC โ†’ cross-compiler for x64 ELF
  • LD โ†’ linker
  • ASM โ†’ assembler (nasm)
  • CFLAGS and ASMFLAGS โ†’ 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 of build/
  • 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 basic readme.txt

๐Ÿ”น Output

After building, you will have:

  • build/ โ†’ contains all .o files and kernel.bin
  • iso/ โ†’ contains GRUB configuration and files required to create the ISO
  • keonOS.iso โ†’ the bootable ISO generated after make iso
  • harddisk.img โ†’ the system's FAT32 disk image

๐Ÿ”น Running keonOS

The keonOS Makefile already provvides a fast way to test and run the OS by running:

make run

This 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.


๐Ÿ”น Debugging with GDB

If unexpected behavior occurs, debugging is useful. GDB comes in handy:

  1. Start QEMU in debug mode.
qemu-system-x86_64 -kernel build/kernel.bin -S -s

You can add custom settings like memory or CPU cores here too.

  1. Connect GDB
gdb build/kernel.elf
target remote :1234

You 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.


๐Ÿ”น Notes & Tips

  • 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.

Clone this wiki locally