A tiny 32-bit kernel made from scratch with very basic features.
The Kernel From Scratch is divided into many projects, each one dealing with a specific aspect of kernel programming.
- KFS-1
- Boot the kernel with grub2
- Keyboard driver to handle keyboard entries
- I/O interface: VGA driver
- Scroll and cursor support.
- Different screens and keyboard shortcuts to switch easily between them.
- Color support.
- Helpers like printk in order to print information / debug easily
- KFS-2
- Memory segmentation (Global Descriptor Table) set at address 0x00000800:
- Kernel code, used to store the executable binary code.
- Kernel data
- Kernel stack, used to store the call stack during kernel execution
- User code, used to store the executable binary code for user programs
- User program data
- User stack, used to store the call stack during execution in userland
- Minimalistic shell with a few commands:
- help
- shutdown
- reboot
- stack
- exit
- Memory segmentation (Global Descriptor Table) set at address 0x00000800:
Run make
to compile the project, make will compile the kernel binary
as well as the kernel iso
under the 'targets' folder.
targets
└── x86
├── iso
│ ├── boot
│ │ ├── grub
│ │ │ └── grub.cfg
│ │ └── kernel.bin
│ └── linker.ld
└── kernel.iso
Note that, for portability purposes, the iso file is created inside a docker container, be sure to install Docker before running make
https://docs.docker.com/engine/install
Of course, you must install QEMU emulator first if you plan to use it.
- QEMU (manual)
After compiling the iso, run TypOS with QEMU emulator by entering the following command
qemu-system-i386 -cdrom targets/x86/kernel.iso
- QEMU (automatic)
Simply runmake run
will compile the project and start QEMU emulation. - QEMU (debug)
The kernel can be debugged at runtime with gdb, runmake debug
then attach the debugger withexec gdb -x debug.tmp
- Another emulator
You are free to use your favorite emulator, just compile the kernel then run the ISO with your choosen emulator.
This given compilation process is only compatible with Linux.
- Ludovic Menthiller (https://github.com/lumenthi)
- Lucas Nicosia (https://github.com/lnicosia)