Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TH-O-R/kernel-mini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Minimal x86 Kernel in C

🚀 Introduction

Have you ever wondered how an x86 machine boots? It's actually pretty straightforward — and now you can see it for yourself.

This project is a minimal kernel written from scratch in C, showing the bare essentials of how to boot, clear the screen, and print text — all without any OS.


📦 What This Kernel Does

  • 🖥 Prints a message directly to the screen (via VGA text buffer).
  • ⚙️ Boots on real hardware using GRUB2 (via Multiboot).
  • 🔧 Runs perfectly inside QEMU (and probably other VMs too).
  • 💡 Clean, beginner-friendly code for learning low-level OS dev.

🛠 How to Build & Run

  • Create object files from kernel.asm and kernel.c:
nasm -f elf32 kernel.asm -o kasm.o
gcc -m32 -c kernel.c -o kc.o
  • Link the object files:
ld -m elf_i386 -T link.ld -o iso/boot/kernel kasm.o kc.o
  • Edit the grub.cfg file if you want to use one:
set timeout=15
set default=0

menuentry "Kernel 420" {
    multiboot /boot/kernel ro
    boot
}
  • If you want to create the ISO:
grub-mkrescue -o kernel.iso iso/

Then to boot using qemu you can either :

1- Use the ISO:

qemu-system-i386 -cdrom kernel.iso

2- Use the binary directly:

qemu-system-i386 -kernel iso/boot/kernel

🔧 Requirements (on Arch Linux)

  • An x86 computer.
  • Packages:
sudo pacman -S qemu-full grub xorriso nasm ld gcc

note: you can also use qemu-base instead of qemu-full but you will need a VNC viewer of some kind to see the results.

  • Packages (alt):
sudo pacman -S qemu-base grub xorriso nasm ld gcc tigervnc

About

A minimal kernel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published