lnicosia / kernel-from-scratch

TypOS - A kernel made from scratch coded in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypOS Generic badge Generic badge

title
A tiny 32-bit kernel made from scratch with very basic features.

Summary

Introduction

The Kernel From Scratch is divided into many projects, each one dealing with a specific aspect of kernel programming.

run

Features

  • 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

Compiling

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

Usage

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 run make run will compile the project and start QEMU emulation.
  • QEMU (debug)
    The kernel can be debugged at runtime with gdb, run make debug then attach the debugger with exec 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.

Compatibility

This given compilation process is only compatible with Linux.

Authors

About

TypOS - A kernel made from scratch coded in C


Languages

Language:C 83.8%Language:Makefile 10.2%Language:Assembly 5.7%Language:Dockerfile 0.2%