Skip to content

twh2898/os

Repository files navigation

os

Following the tutorials under https://github.com/cfenollosa/os-tutorial

Active and planned work is tracked in notes.md

For current specs see

Goals

The OS will be finished when all of the following are implemented.

  1. Able to get and draw basic http web page
  2. Compiler for at least Assembly or C
  3. Playable Minecraft Clone

The following lists show the planned development stages and planned tasks to achieve these goals.

Near Near Term

  • Read extended kernel form floppy
  • Switch to protected mode
  • some stdio.h
  • printf
  • some string.h
  • keyboard driver
  • ata driver
  • terminal with command parsing
  • circular buffer + tests (builtin, needs separating)

Near Term

  • Kernel stats (stats command returns # disk io, keys, mounts, etc.)
  • Detect stack overflows
  • fs
    • Finish implementing fs functions
    • Implement file io
  • basic malloc (linked list)
  • malloc
    • Actually manage memory
    • Need to find end of kernel to not overflow at runtime (for malloc start)
    • Detect max memory for malloc
    • Do that fancy memory map
  • Paging
    • Setup page dir and table
    • Enter paging
  • Load user space application
  • Ring 3
    • Kernel Service Calls
  • Date and Time
  • Optional don't disable interrupts during interrupt (nested interrupts)
  • Better key event buffer (with mods) (maybe in addition to char buffer)
  • Change stdlib names with k prefix for namespace during testing
  • Optimize disk read to check if area already in buffer

Long Term

These tasks will be broken down further after completion of Near Term, when there is a better foundation and design to work with.

  • Switch to 2d graphics mode
  • Virtual memory pages / memory paging
  • Memory permissions (eg. stack can't exec, code can't write)
  • User level applications (might need 3rd level kernel from filesystem)
  • Testing
  • FAT or EXT2 filesystem driver
  • Audio Driver
  • 64 bit support printf (needs libgcc)
  • Text editor

Long Long Term

These tasks will be broken down further after completion of Long Term, when there is enough support for their development.

  • Graphics card driver (pseudo opengl)
  • Threading / multi-process
  • (Maybe) Multiboot or GRUB?

Setup

git clone [email protected]:twh2898/os.git
cd os
make setup

Building

make build

Running

make run

Once running, use the help command to see what you can do.

Testing

make test
make test_cov
make test_cov DARK_MODE=ON

Formatting / Linting

make lint
make format

Format drive.img

After creating the drive image with make drive.img you can format and mount it using the following.

Setup file as drive

modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 drive.img

Format drive

fdisk /dev/nbd0
mkfs.fat -F32 /dev/nbd0p1

Fdisk commands should be onp1 w

Mount the drive

mount /dev/nbd0p1 drive

Unmount the drive

umount drive
qemu-nbd -d /dev/nbd0
rmmod nbd