Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gasna/kfs-1
This first (out of 10) project is a very basic kernel with some basic features.
https://github.com/gasna/kfs-1
42 42-school 42born2code 42paris 42school assembly assembly-language assembly-language-programming assembly-x86 basic-kernel c c-language c-language-programming kernel kernel-development
Last synced: about 15 hours ago
JSON representation
This first (out of 10) project is a very basic kernel with some basic features.
- Host: GitHub
- URL: https://github.com/gasna/kfs-1
- Owner: GAsNA
- Created: 2024-12-14T21:40:39.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-01-23T18:19:44.000Z (about 23 hours ago)
- Last Synced: 2025-01-23T19:24:59.414Z (about 22 hours ago)
- Topics: 42, 42-school, 42born2code, 42paris, 42school, assembly, assembly-language, assembly-language-programming, assembly-x86, basic-kernel, c, c-language, c-language-programming, kernel, kernel-development
- Language: C
- Homepage:
- Size: 340 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KFS-1
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.
![](images/preview_kfs-1_rleseur.gif)
**Options**:
- [x] Color support
- [x] Keyboard handler
- [x] Helper 'printk'
- [ ] Scroll and cursor support
- [x] Different screens helper and keyboard shortcut
- [x] 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-``. 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
- The BIBLE, for basic kernel: https://arjunsreedharan.org/post/82710718100/kernels-101-lets-write-a-kernel
- The BIBLE 2, for keyboard: https://arjunsreedharan.org/post/99370248137/kernels-201-lets-write-a-kernel-with-keyboard
- For keyboard scancodes: https://aeb.win.tue.nl/linux/kbd/scancodes-1.html
- For another system of keyboard, color and build iso image: https://theogill.medium.com/creating-a-kernel-from-scratch-1a1aa569780f
- To move the cursor: https://hasinisama.medium.com/building-your-own-operating-system-drivers-8adfc889398b