You are browsing as a guest. Sign up (or log in) to start making projects!

pefiaOS , a bare-metal x86 operating system with a graphical shell

  • 3 Devlogs
  • 7 Total hours

I am building an x86 OS from scratch using C, with some included apps.

Ship #1 Pending review

## Overview

pefiaOS is a bare metal 32-bit x86 operating system written entirely from scratch in C and NASM. It contains around **9,000 lines of kernel code** with no libc or third party kernel code.

### Features

* Graphical desktop with overlapping windows, taskbar, Start menu, and window manager
* Complete networking stack (Ethernet, ARP, IPv4, ICMP, UDP, DHCP, DNS, TCP)
* TLS 1.3 implementation from scratch for real HTTPS support
* Web browser with HTML rendering and inline image support
* Five built in games including Flappy Bird, Pong, Tetris, a Mario style platformer, and a Wolfenstein style raycaster
* Runs the original 1993 DOOM through PureDOOM inside a desktop window

## Challenges

Some of the more difficult parts of the project included:

* Writing TLS 1.3 and its cryptographic primitives entirely from scratch
* Building a complete TCP/IP networking stack without timer interrupts
* Implementing DEFLATE, JPEG, and BMP decoders by hand
* Running everything in a cooperative single threaded kernel
* Integrating the real DOOM engine into a freestanding bare metal environment

## Highlights

I'm especially proud that pefiaOS isn't just a toy kernel. It can browse the real web over HTTPS, run a full graphical desktop, play games, and even run the original DOOM, all on hardware with no host operating system, no libc, and no runtime underneath.

## Running pefiaOS

After building the cross compiler, simply run:

```bash
make
make run
```

Or boot `pefiaOS.iso` in VirtualBox using an Intel PRO/1000 network adapter.

### Things to try

* Browse a real HTTPS website
* Play one of the built in games
* Launch DOOM from the Start menu
* Open the terminal and run `about`
* Capture network traffic with `make run-net`

## Current limitations

* No audio support yet
* TLS does not verify server certificates
* No preemptive multitasking
* No JavaScript engine

The part that still feels surreal is watching the OS boot, opening the browser, and loading real HTTPS websites from the internet on an operating system I built entirely from scratch.

  • 3 devlogs
  • 7h
Try project → See source code →
Open comments for this post

1h 19m 38s logged

Bringing Games (and DOOM) to pefiaOS

This update was all about making pefiaOS capable of running real time applications. The desktop was originally designed around event driven apps, so games needed quite a bit of work before they were even possible.

What’s new?

  • Off screen rendering to eliminate flickering
  • Proper held key input for responsive controls
  • Fixed timestep game loop
  • Resizable game windows
  • Flappy Bird
  • Pong
  • Tetris
  • Mario style platformer
  • Wolfenstein style 3D raycaster

Once those were working, I had to answer the obvious question: can it run DOOM? It turns out it can. I integrated PureDOOM by writing a platform layer that hooks the engine into my own memory allocator, timer, input system, framebuffer, and virtual filesystem. Since there’s no disk driver yet, the shareware WAD is embedded directly into the kernel, meaning DOOM now runs inside a normal desktop window on pefiaOS itself. Seeing the real 1993 DOOM running on an operating system I built from scratch has easily been one of the most rewarding moments of the project so far, and it also kinda shows that it can do something cool too, not just boring kernels and such.

0

Loading discussion…

0
8
Open comments for this post

1h 42m logged

PefiaOS Browser Engine Update - 12:35AM

  • Replaced old HTML renderer with a proper DOM tree system
  • Added CSS engine
    • basic cascade
    • box model layout
  • Implemented lightweight JavaScript interpreter
    • variables
    • loops
    • getElementById()
    • innerHTML

Bug Fix

  • Fixed image caching bug caused by reading bitmap dimensions after freeing memory
  • Issue resulted in images being stored as 0×0 and rendering as blank white boxes
  • PNG rendering now works correctly again (including Google logo)

Result

  • Pages now render using DOM structure
  • CSS styling is partially functional
  • JavaScript enables basic interactivity
  • Image rendering is stable again
  • Google homepage renders significantly more correctly
0

Loading discussion…

1
11
Open comments for this post

3h 29m 59s logged

I have currently written the operating system from scratch, created a GUI (Graphical User Interface) and a window manager. I have apps such as a terminal with Linux-inspired commands and a working Browser written from scratch! Google doesn’t serve plain HTTP anymore, so getting to google.com meant implementing modern cryptography inside my own kernel. I ended up writing SHA-256, HMAC/HKDF, AES-128-GCM and X25519 myself before finally getting the handshake to complete. Most of the debugging came down to tiny mistakes—one incorrect byte somewhere could make the whole connection fail. Once that finally worked, I could build the browser on top of it. Right now it has a basic HTTP client and a renderer that supports enough HTML and CSS to display text with word wrapping, links and scrolling.

6

Loading discussion…

0
45

Followers

Loading…