Skip to content

A minimal operating system (2K LOC) on QEMU and a RISC-V board

License

Notifications You must be signed in to change notification settings

P-Gu/egos-2000

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A minimal operating system on a small RISC-V board

With only 2K lines of code, egos-2000 implements boot loader, microSD driver, tty driver, memory paging, address translation, interrupt handling, process scheduling and messaging, system call, file system, shell, 7 user commands and the mkfs/mkrom tools. It runs on a $129 small development board.

This is an image

# Count lines of code excluding references and README.md
> cloc egos-2000 --exclude-ext=md
......
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               33            449            464           1564
C/C++ Header                    11             75            104            314
Assembly                         3              6             24             68
make                             1             11              0             54
-------------------------------------------------------------------------------
SUM:                            48            541            592           2000 << exactly 2000!
-------------------------------------------------------------------------------

Earth and Grass Operating System 2000

egos-2000 and egos are the teaching operating systems we use at Cornell. They have the same architecture.

  • The earth layer implements hardware-specific abstractions.
    • tty and disk device interfaces
    • cpu interrupt and memory management interfaces
  • The grass layer implements hardware-independent abstractions.
    • processes, system calls and inter-process communication
  • The application layer implements file system, shell and user commands.

The definitions of struct earth and struct grass in egos.h specify the interfaces between different layers.

Hardware Requirements

Software Requirements

Usages and Documentation

For compiling and running egos-2000, please read USAGES.md. This document further introduces the teaching plans, architecture and development history of egos-2000.

The RISC-V instruction set manual introduces the privileged registers used by egos-2000. The SiFive FE310 manual introduces the processor used by egos-2000, especially the GPIO, UART and SPI bus controllers.

For any questions, please contact Yunhao Zhang. Many thanks to Robbert van Renesse and Lorenzo Alvisi for their support. This project is also supported by a Facebook fellowship.

About

A minimal operating system (2K LOC) on QEMU and a RISC-V board

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • C 94.6%
  • Makefile 3.1%
  • Assembly 2.2%
  • GDB 0.1%