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

  • 6 Devlogs
  • 41 Total hours

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

Open comments for this post

6h 7m 19s logged

67 hours !!!!!!!!

This update was mainly about improving the web browser and fixing bugs I found across the OS.

The browser is now much more capable than before. I added a much better CSS engine, a lot more JavaScript features, proper form support with POST requests, cookies, animated GIFs, media placeholders, and lots of networking improvements. I also changed the homepage to DuckDuckGo Lite, so you can actually search the web from inside pefiaOS.

I also fixed several kernel bugs, including memory corruption issues, framebuffer bugs, safer memory management, more reliable timing, and network driver improvements.

Building the OS is easier now too. If you don’t have the cross compiler installed, it can now use your system GCC instead. I also improved VM compatibility by adding better diagnostics when booting with the wrong firmware.

There is still a lot I want to add, like UTF-8 support, certificate verification, paging, and user mode, but this is the biggest browser update pefiaOS has had so far.

0
0
36
Open comments for this post

15h 41m 32s logged

Devlog 05 - The Return: Giving pefiaOS a real kernel

This update was mostly focused on replacing a lot of the “fake OS” parts with real operating system infrastructure.

The biggest milestone was getting interrupts working. I added my own GDT, built an IDT with exception and IRQ handlers, remapped the PIC, programmed the PIT to 100 Hz, and implemented kernel threads with a handwritten x86 context switch. The scheduler is still cooperative because the heap and window manager aren’t thread safe enough for preemption yet, but background threads can finally run independently.

I also wrote an ATA PIO driver capable of reading and writing real IDE disks using LBA28 addressing. On top of that I rewrote the VFS into a writable, heap-backed filesystem, so applications can now create, modify and delete files instead of relying on a compile-time file table. Persistence is still missing, but FAT32 can now be built on top of the driver.

The desktop gained a lot of new functionality too. The code editor now supports syntax highlighting and line numbers, the terminal gained proper filesystem commands like mkdir, touch, rm, cat, echo > file, and ps, and I added both C and Python-style interpreters using the same recursive descent expression engine.

Graphics also received a major upgrade. The desktop now runs at 1920x1080 and I replaced the old 1-bit bitmap font with grayscale anti-aliased glyphs generated from Consolas. The renderer blends glyph coverage into the framebuffer, making text much easier to read without changing any existing layouts.

I also improved the desktop itself with window snapping, a scrollable Start menu, a live Settings app for themes and system settings, interactive browser text inputs, and a number of browser rendering improvements including larger page support and faster text drawing.

The hardest part was getting all these systems working together. Interrupts initially caused repeated triple faults because my descriptor tables were wrong, the scheduler had to coexist with the existing window manager, and changing the VFS meant updating almost every built-in application.

To make sure nothing regressed, I added a boot self-test that verifies the interpreter, writable VFS, scheduler, timer interrupts and ATA disk driver every time the OS starts.

Things I’d love people to test:

  • Open multiple windows and try snapping them around the desktop.
  • Use the terminal to create, edit and delete files.
  • Open the code editor and test syntax highlighting.
  • Try typing into browser text inputs.
  • Change the desktop theme and accent colour in Settings.

This update doesn’t add one huge feature, but it lays the groundwork for the next major milestones: paging, user-mode processes, ELF loading, and a persistent filesystem.

0
0
66
Open comments for this post

12h 50m 48s logged

Devlog — Snake, Breakout, a Smarter Shell, and Build Hygiene

This week I added two new games (Snake and Breakout, bringing the total to seven), expanded the shell with new built-ins and command history, and cleaned up the build system. Everything boots and runs in QEMU.

Snake

The ring buffer approach makes movement O(1) instead of O(n):

uint16_t s_body[SN_CAP];        /* ring buffer of cell indices */
int      s_head, s_len;

Input and movement run on separate clocks. Input latches every 33 ms, movement every 130 - 4×score ms (minimum 60 ms). This way no keypresses drop and difficulty scales naturally.

The grid is 16 pixel cells, clamped to window size. Apples spawn via rejection sampling. Filling the entire board wins the round.

Breakout

26.6 fixed point physics handles shallow angles that integer pixels would quantise to zero. Paddle english depends on where you hit it:

int off = bx - g->k_px;
g->k_bvy = -g->k_bvy;
g->k_bvx = (off << 6) / (pw / 6);

Ball starts stuck to the paddle, launches with Space. Three lives, then game over.

Integration

Adding two games touched almost no window-manager code. Two enum entries in games.h, two lines per dispatch switch in games.c, and the Start menu entry in taskbar.c. The WM handles everything else automatically.

Shell Improvements

Added five new built-ins: free, uptime, history, ver, and fixed echo to print blank lines. Terminal got uptime too.

One Version String

#define PEFIA_VERSION "pefiaOS 0.3 (Stardance)"

All three places that display version now build from this single define.

Build Fixes

Fixed header dependency tracking:

CFLAGS += -MMD -MP
-include $(OBJS:.o=.d)

Editing a header now correctly rebuilds only the objects that include it. Cleaned up boot.asm trailing whitespace too.

Testing

Verified in my virtual machine: both games launch and play correctly, Terminal shows the new version string, all shell commands work.

Seven games on a kernel I wrote from scratch!! :D

0
0
36
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:

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
0
29
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
2
1
27
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
0
98

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…