Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

UnmappedStack/SpecOS

Repository files navigation

SpecOS

Commit activity Codacy Badge GitHub top language GitHub license

An x86-64 OS kernel from scratch.

☠️ WOW, IT'S DEAD!

SpecOS is very broken. I've archived this project and will be working on a new, better kernel, PotatOS.

NOTE

This project is still in very early stages, and should NOT be used on real hardware. The code is quite messy and is currently a series of messy C files. Seriously, don't learn anything from this project.

SpecOS is a 64 bit operating system kernel for x86-64 processors, still in quite early stages, written in (questionable quality) C. It is (not very) powerful.

This used to be 32 bit, but has been transferred to a 64 bit operating system.

It uses a monolithic kernel, because I like having everything in one place. This may take some inspiration from other operating systems, but it is not UNIX based.

See some of the resources I used for learning, as well as some other OS projects that I think are pretty amazing in resources.md. There's also a few unsolicited OS development opinions of mine in there (:

I have a Discord server for SpecOS where I will share most updates, and can also provide you help with OS development. You can join here.

Building and running

This works best on Linux (Mac should also be fine). If you're using Windows, it's best to use WSL.

To compile

Make sure that you have GCC installed. Then simply clone the repo, cd into it, make compile.sh runnable and run the script:

git clone https://github.com/jakeSteinburger/SpecOS.git
cd SpecOS
chmod +x compile.sh
./compile.sh

Note that you must be inside the scripts directory to run the compile script.

This will generate a an executable disk image that you can run with qemu.

Running

WARNING TILING WM USERS!

Qemu doesn't really like tiling mode, it'll cause it to show only part of the screen! Make sure that you run Qemu with floating window mode only.

On Qemu

Simply cd into the directory of the built .img file, and run:

qemu-system-x86_64 disk.img

You'll obviously need Qemu installed.

On real hardware

In the directory of the .img file, run:

sudo dd if=disk.img of=/dev/sdN status=progress

With /dev/sdN being the name of your USB. Then in your device's unique BIOS, change the boot order so it will boot from USB before your current OS, and restart with your now-formatted USB plugged in.

Roadmap

Some things that I gotta do, and some things that I have done, in SpecOS. Yeah, there's a lot I haven't done. Really gives an idea on just how much there is to do.

  • First steps
    • VGA driver
    • Interrupt handling
    • PS/2 Keyboard support
  • RTC driver
  • ATA PIO mode hard disk driver (28 bit LBA)
  • FAT filesystem
    • Read (cd, ls, cat)
    • Write (mkdir, touch, rm, editfile, cp, mv)
  • Do better scrolling
  • Memory management
    • Physical memory management (pooling allocator)
    • Virtual memory management (paging)
    • Kernelspace heap
    • Userspace heap
  • ELF parsing
  • Switch to 64 bit higher half
    • Set up Limine (w/ loopback device)
    • Write 64 bit version of GDT & IDT
    • Draw text to graphical framebuffer provided by limine
    • Port to 64 bit version (FAT, RTC, hard disk driver, keyboard)
    • Detect memory with limine
    • Re-write PMM to use bitmap instead of pooling
    • Re-write 64 bit version of paging
  • Jump to userspace (apps are a big milestone for me!)
  • Write libc (maybe port one? I don't really know yet.)
  • Some sort of NIC driver
  • Port lwIP for networking (I can't bother writing this myself)
  • Some ports
    • Vim (or some other text editor)
    • Python (possibly very difficult)
  • More drivers for compatibility
    • USB (likely very hard)
    • SSD
    • HDMI
    • DVI
    • More NIC drivers
  • GUI
    • Window server + plotting pixels
    • Text with a custom font
    • Mouse driver
    • Present another app's frame buffer within the main GUI
    • Window management: moving, closing, resizing
    • A few GUI apps for settings etc.
  • ACPI driver (really should be a higher priority...)
  • Write a basic web browser (possibly very hard, but I was thinking of doing this as a seperate project anyway, so why not combine?)

It's a road to running DOOM!

Note that a lot of this is unrealistic and probably won't happen - it's a lot easier said that done. But my hopes are high (:

Special thanks

You didn't really think that I could do this alone of all people, did you? I'm not a genius! Thank you so, so much to these people who have made my journey in operating system development so much easier!

  • Bananymous is a super smart guy, who taught me a ton. He also wrote the amazing Banan-OS!
  • Dcraftbg has taught me a whole lot about paging and a few other topics. He also just managed to enter userspace on his MinOS, nice one :D