Skip to content

A tiny operating system kernel (targeting x86-elf) that aims to be a teaching tool

Notifications You must be signed in to change notification settings

frizensami/ramos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ramos

Ramos is a small kernel that was initially developed to explore operating systems concepts and implementation. Its main goal is to be a teaching platform for learning about OSs.

Requirements to run this OS

  1. Make
  2. i686-elf-gcc Cross-Compiler. Refer to Why do I need a cross-compiler? and for how to compile a cross-compiler from source code, GCC Cross-Compiler. An easier method if you just want to try this toy OS out is to get a pre-compiled cross-compiler at https://github.com/lordmilko/i686-elf-tools
  3. QEMU to run the OS itself on emulated hardware, specifically qemu-system-i386
  4. (Optional) Bochs: Another emulator.
  5. (Optional) genisoimage if you want to create an ISO for Bochs, or to put onto an external drive.

How to run the OS

Ramos is most easily tested with an emulator like QEMU or Bochs, although I believe you could get the ISO onto a USB drive and boot from it. I have not tried this yet, do so at your own risk.

  • make run will compile and run Ramos on QEMU. I tend use this for testing almost all the time.
  • make run-bochs will do the same for Bochs. An ISO file is generated in the process. I tend to do this when I need to confirm that I am seeing the same behavior on both emulators. Remember to type c into the Bochs terminal to start running the OS.

Level System

I will continue active development on master.

However, to encourage learning, I am creating multiple branches off master that are different "checkpoints" that learners can pick up OS development from. For example, the level1 branch contains only enough code to boot the OS and print text to the screen. After switching to a level* branch, you can find that branch's state in level*.MD, e.g. for level1 the file describing the current state will be in level1.MD.

Have fun!

Implemented Features

  • Simple VGA-buffer text terminal with scrolling
  • Ability to read Multiboot header information
  • Prints memory map from Multiboot information
  • Implement interrupt system for timer (PIT) and keyboard
  • Implements a basic kernel command line shell
  • die() command in kernel libk to print registers and halt kernel.
  • Implements basic dynamic memory allocation in kernelspace with malloc() and free()

Planned Features

  • Create an abstraction for processes (PCB, scheduling). Consider multicore.
  • Add command framework to kterm (command, args, etc). Have useful utilities (register state, memory state, malloc, free, processor info, etc)
  • Dump memory space / stack frames on crash

Not-planned Features

  • No current plan exists for implementing a userspace

Structure

  • boot: Code dedicated to the boot process and kernel_main function (entry point to kernel)

    • Flow of control:
      • Bootloader calls start.s, which loads the multiboot information onto the stack, then kernel.c's kernel_main function.
      • Terminal is initialized
      • Memory manager is initialized using multiboot information from GRUB
      • The GDT and IDT are set up
      • The keyboard and internal timer are initialized
      • Interrupts are enabled to start receiving events from the hardware
      • The kernel terminal (kterm) begins reading from the keyboard key buffer and processes user commands
    • linker.ld script: Links all object files into final .elf file for the bootloader to run. start.s is first to be executed, with the multiboot header at the top of the executable.
  • io: Code related to io devices like the keyboard, terminal and their interrupt handlers

  • lib: Common libraries and definitions for rest of codebase

  • mm: Memory management code

About

A tiny operating system kernel (targeting x86-elf) that aims to be a teaching tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published