Skip to content
/ KFS-1 Public

This first (out of 10) project is a very basic kernel with some basic features.

Notifications You must be signed in to change notification settings

GAsNA/KFS-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KFS-1

Static Badge


Discover the world of "Kernel Programming" and learn how to create your very own Kernel from scratch.

This project is the first in a serie of 10 projects, introducing into the Kernel world. This first project is a very basic kernel with some features.

Is based on a i386 (x86) architecture.

Options:

  • Color support
  • Keyboard handler
  • Helper 'printk'
  • Scroll and cursor support
  • Different screens helper and keyboard shortcut
  • Create Iso image from kernel binary

Shortcuts:

  • F1: go to previous screen
  • F2: go to next screen

TODO:

  • Cursor in position before changing screen (actually, it's going to end of buffer)
  • Fix deletion for \n and \t
  • Clean code for .h please
  • Store files in different folders (in src/kernel)
  • Control deletion on terminal (keep in memory the last char that can be deleted)
  • Check for TODO in code

NB: you can use the dependencies.txt to install all necessaries packages. sudo apt/dnf install $(cat dependencies.txt)

KERNEL

Compilation

Simple way

make

Hard way

$ nasm -f elf32 boot.asm -o boot.o
$ gcc -m32 -c kernel.c -o kernel.o
$ ld -m elf_i386 -T link.ld -o [your kernel name] boot.o kernel.o

It is recommended to name your kernel with the formal: kernel-<version>. I named mine "kernel-kfs.1.rleseur".

Run on QEMU

Simple way

make run-kernel

Hard way

qemu-system-i386 -kernel [your compiled kernel]

Installation

  • Take the last Debian ISO and make a VM in virtualbox.

  • Clone the repo in it.

  • Copy the compiled kernel in /boot directory.

  • Modify the /boot/grub/grub.cfg and add an entry:

menuentry 'My Kernel' {
	set root='hd0,msdos1'
	multiboot /boot/[your compiled kernel] ro
}
  • Reboot and select My Kernel entry.

ISO

Compilation

Simple way

make iso

Hard way

$ mkdir -p /iso/boot/grub
$ cp [your compiled kernel] /iso/boot
$ cp grub.cfg /iso/boot/grub
$ grub-mkrescue -o [your iso name] iso

Run on QEMU

Simple way

make run-iso

Hard way

qemu-system-i386 -cdrom [your iso]

Resources