展示HN:Aurion OS – 用C从头编写的32位GUI操作系统
Show HN: Aurion OS – A 32-bit GUI operating system written from scratch in C

原始链接: https://github.com/Luka12-dev/AurionOS

## AurionOS:一个注重学习的操作系统 AurionOS是一个32位x86操作系统,由一位13岁的开发者用C语言和x86汇编从头开始构建,作为一个学习项目。它专为希望深入理解计算机的人设计,摒弃了现代抽象,以揭示硬件和CPU的核心逻辑。 该操作系统具有自定义引导加载程序、内核、内存管理(使用堆管理器)、VESA图形和窗口管理器,以及一个完整的TCP/IP协议栈,包括DHCP。它还包括一个自定义扇区文件系统(AurionFS),支持FAT12,以及一个拥有超过100个命令的命令行 shell。新命令可以轻松地直接在内核中添加。 AurionOS通过系统调用提供内核服务,目前处于测试阶段,正在进行错误修复。最好使用QEMU、VirtualBox或VMware来体验它。虽然实机启动正在开发中,但该项目完全开源,采用MIT许可证,体现了“每一字节都很重要”的原则。

相关文章

原文

The Horizon of Retro-Modern Computing

AurionOS Desktop

AurionOS A 32-bit x86 operating system built from scratch in C and x86 Assembly. Developed as a solo learning project by a 13-year-old over the course of 14 days

AurionOS is built for the tinkerers who want to see every byte move. By stripping away modern abstractions, we reveal the elegant logic of the CPU and the hardware. Every line of code serves a purpose, offering a bloat-free environment for learning and development.

  1. Ensure you have QEMU and NASM installed.
  2. Run the following command:

Why does this work? The Makefile compiles the assembly bootloader and the C kernel, links them at 0x10000, and packages them into a bootable image. QEMU then loads this image, starting the execution at the BIOS handoff point.

1. The Bootloader (src/bootload.asm)

Starts in 16-bit Real Mode, enables the A20 gate, sets up the GDT, and transitions the CPU to 32-bit Protected Mode before jumping to the kernel.

2. The Kernel Entry (src/kernel.asm)

Initializes the stack and the Interrupt Descriptor Table (IDT), then calls the C kmain function to begin high-level initialization.

3. Memory Management (src/memory.asm)

Uses a Memory Control Block (MCB) heap manager starting at the 1MB mark, providing kmalloc and kfree for dynamic memory allocation.

4. VESA Graphics (src/vesa.asm & src/drivers/vbe_graphics.c)

Utilizes VBE (VESA BIOS Extensions) for high-resolution linear frame buffers. The window manager handles Z-order, clipping, and redrawing.

5. Networking (src/tcp_ip_stack.c)

Includes a custom implementation of Ethernet, ARP, IPv4, ICMP, and UDP, alongside a DHCP client for automatic IP configuration.

Use WSL2 (Ubuntu) for the best experience:

sudo apt update
sudo apt install -y build-essential nasm gcc make binutils qemu-system-x86 genisoimage
make run
sudo apt update
sudo apt install -y build-essential nasm gcc make binutils qemu-system-x86 genisoimage
make run
sudo pacman -S base-devel nasm gcc make qemu-desktop cdrtools
make run
brew install nasm qemu cdrtools make
make run
  • Build via make all
  • Run with VMware or VirtualBox instead of QEMU.

AurionOS provides kernel services via INT 0x80.

Syscall ID Name Description
0x01 SYS_PRINT_STRING Print a null-terminated string to console.
0x02 SYS_PRINT_CHAR Print a single character.
0x04 SYS_READ_CHAR Read a character from keyboard (blocking).
0x05 SYS_CLEAR_SCREEN Clear the terminal.
0x08 SYS_SET_COLOR Set terminal text attributes.
0x50 SYS_GET_TIME Get current CMOS time.
0x51 SYS_GET_DATE Get current CMOS date.
0x52 SYS_GET_TICKS Get timer ticks since boot.
0x61 SYS_READ_SECTOR Read raw disk sector.
0x71 SYS_SHUTDOWN Power off the system.

AurionOS uses a custom sector-based filesystem (AurionFS) for persistent storage. It stores file metadata in reserved sectors (starting at LBA 500) and file contents in a dedicated data area (starting at LBA 700).

  • In-Memory Cache: The kernel maintains an fs_table for quick access to file metadata.
  • Persistence: Changes are flushed to disk using fs_save_to_disk().
  • Legacy Support: A FAT12 driver (src/filesys.asm) is also available for reading external media.

The Command Shell (src/shell.c)

The shell is the primary CLI interface, supporting over 100 commands. Commands are dispatched via a central table in src/commands.c.

  • DIR: List files in the current directory.
  • CAT <file>: View file contents.
  • NANO <file>: Edit text files.
  • NETSTART: Initialize networking and DHCP.
  • GUIMODE: Switch to the graphical desktop.
  • PYTHON: Launch the minimal Python interpreter.

Writing Your First AurionOS Command

To add a new command to the OS, you don't need a separate binary - simply register it in the kernel:

  1. Implement the command in src/commands.c:
    static int cmd_demo(const char *args) {
        puts("Hello, AurionOS World!\n");
        return 0;
    }
  2. Register it in the commands[] table at the end of src/commands.c:
    static const Command commands[] = {
        ...
        {"DEMO", cmd_demo},
        {NULL, NULL}
    };
  3. Compile and Run: Run make run and type DEMO in the shell.
  • Real hardware boot is currently unstable (working on it!)
  • Best experience: QEMU, VirtualBox, or VMware
  • This is a beta release - bugs are expected and being fixed

AurionOS is licensed under the MIT License.


AurionOS - Where Every Byte Matters Built with passion by Luka. March 2026.

联系我们 contact @ memedata.com