Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
0e65ebd
Implement v0 UEFI kernel with service registry and shell loader
google-labs-jules[bot] Feb 13, 2026
7f2bea6
Refine kernel lifecycle and shell input
google-labs-jules[bot] Feb 13, 2026
aa767e7
Finalize UEFI kernel with comprehensive Makefile
google-labs-jules[bot] Feb 13, 2026
e337c14
Finalize UEFI kernel with robust build system and persistent shell
google-labs-jules[bot] Feb 13, 2026
d09f19e
Finalize v0 UEFI kernel with fix for console output and robust Makefile
google-labs-jules[bot] Feb 13, 2026
e0a8967
Ensure UEFI standard compliance and robust console output
google-labs-jules[bot] Feb 13, 2026
11cbfb1
Finalize v0 UEFI kernel with bootable FAT image and robust output
google-labs-jules[bot] Feb 13, 2026
381e36f
Finalize v0 UEFI kernel with robust architecture and build system
google-labs-jules[bot] Feb 13, 2026
c0e2b95
Refactor kernel services to be UEFI-free and modular
google-labs-jules[bot] Feb 13, 2026
b15e510
Implement v0 UEFI Kernel with Service Registry and Graphical Shell
google-labs-jules[bot] Feb 13, 2026
0ff19f8
Finalize UEFI Kernel with root Makefile and service-oriented architec…
google-labs-jules[bot] Feb 13, 2026
0ad0563
Final cleanup: Remove all binary artifacts and ensure root Makefile
google-labs-jules[bot] Feb 13, 2026
fb3f549
Final v0 Submission: Pure source implementation with root Makefile
google-labs-jules[bot] Feb 13, 2026
0ee8233
Final v0 UEFI Kernel: Fix text rendering and clean source submission
google-labs-jules[bot] Feb 13, 2026
8afe12a
Epic Kernel Update: Refactored main, python-like IO, and USB support
google-labs-jules[bot] Feb 13, 2026
f2484b0
Final Epic UEFI Kernel: Refactored architecture, clean IO, and USB su…
google-labs-jules[bot] Feb 13, 2026
695563a
Refine Makefile and improve input backspace handling
google-labs-jules[bot] Feb 13, 2026
98159b4
UEFI Kernel Update: Improve font rendering and build system
google-labs-jules[bot] Feb 13, 2026
98dbb2d
Final v0 UEFI Kernel: Refactored architecture, Python-like IO, and fi…
google-labs-jules[bot] Feb 13, 2026
c4efcf0
Rebrand to OSx2 (RTECH dos) and refactor kernel structure
google-labs-jules[bot] Feb 14, 2026
9ca09d7
Refactor kernel to OSx2 architecture with modular service registry
google-labs-jules[bot] Feb 14, 2026
e794129
Add USB Controller Detection service to OSx2
google-labs-jules[bot] Feb 14, 2026
58e395e
Fix USB keyboard support in VGA mode and implement hardware-based pol…
google-labs-jules[bot] Feb 14, 2026
d0e3048
Implement unified Serial and USB keyboard input for OSx2
google-labs-jules[bot] Feb 14, 2026
83e0a74
Implement Centralized Input Mapping Service for OSx2
google-labs-jules[bot] Feb 15, 2026
9c4eeba
Update Makefile for standard QEMU USB config and implement robust har…
google-labs-jules[bot] Feb 15, 2026
95c778c
Implement Native xHCI Host Controller and Centralized Input Mapping
google-labs-jules[bot] Feb 15, 2026
ba34d44
Implement unified Input Method Detection and Device Inventory
google-labs-jules[bot] Feb 15, 2026
46f279c
Refactor OSx2 kernel to modular service-registry architecture
google-labs-jules[bot] Feb 15, 2026
071ae50
Finalize OSx2 (RTECH dos) architecture and add update target
google-labs-jules[bot] Feb 15, 2026
504248b
Add -machine pc to QEMU and implement make menuconfig
google-labs-jules[bot] Feb 15, 2026
d4eedc2
Implement robust PS/2 keyboard initialization and polling
google-labs-jules[bot] Feb 15, 2026
adfb5c0
Add verbose PS/2 status reporting and polling verification
google-labs-jules[bot] Feb 15, 2026
41a7664
Enable silent PS/2 scancode to character translation
google-labs-jules[bot] Feb 15, 2026
7a45110
Enable automated ISO generation in Makefile
google-labs-jules[bot] Feb 15, 2026
df5847f
Enable automated ISO generation and clean repository state
google-labs-jules[bot] Feb 15, 2026
fd68fde
Fix PS/2 keyboard mapping and enable scancode translation
google-labs-jules[bot] Feb 16, 2026
47fe501
Implement RNAFS v1 and Disk Manager (diskman) service
google-labs-jules[bot] Feb 16, 2026
804c8c6
Finalize RNAFS v1 and PS/2 character mapping
google-labs-jules[bot] Feb 16, 2026
e3feb67
Implement FAT16 formatting and dynamic partitioning
google-labs-jules[bot] Feb 16, 2026
eed33a8
Protect EFI System Partition (EFS) from repartitioning and formatting
google-labs-jules[bot] Feb 16, 2026
a91bebf
Implement power management and Linux-style modular Makefile
google-labs-jules[bot] Feb 16, 2026
bf72865
Refine power management logic and modular build system
google-labs-jules[bot] Feb 16, 2026
f30a828
Refine hardware-level power management logic
google-labs-jules[bot] Feb 16, 2026
86784ed
Add OS metadata file and integrate into system
google-labs-jules[bot] Feb 16, 2026
1961415
Implement modular UEFI kernel with service registry and event system.
google-labs-jules[bot] Feb 16, 2026
e5bb25d
Refine modular kernel and implement strictly isolated RNAFS.
google-labs-jules[bot] Feb 16, 2026
0361189
Restructure services into packages and finalize kernel-shell handoff.
google-labs-jules[bot] Feb 17, 2026
78460da
Finalize modular kernel with Disk Manager and package-based services.
google-labs-jules[bot] Feb 17, 2026
1480f15
Fix Makefile and RNAFS memory management.
google-labs-jules[bot] Feb 17, 2026
fb12134
Fix root Makefile and finalize RNAFS implementation.
google-labs-jules[bot] Feb 19, 2026
e86afcb
Fix UEFI structure layouts and finalize RNAFS implementation.
google-labs-jules[bot] Feb 22, 2026
a6602ad
Implement Disk Manager with partitioning and FATFS/RNAFS isolation.
google-labs-jules[bot] Feb 22, 2026
6c57ed2
feat: implement minimal v0 UEFI kernel with service registry and shel…
google-labs-jules[bot] Feb 22, 2026
2d79c82
feat: final v0 UEFI kernel implementation with GPT/UEFI-ready disk im…
google-labs-jules[bot] Feb 23, 2026
7d1f3f4
feat: implement functional v0 kernel with full syscall API (no stubs)
google-labs-jules[bot] Feb 24, 2026
27b4331
feat: implement freestanding v0 kernel with custom drivers
google-labs-jules[bot] Feb 25, 2026
adefbda
fix: complete kernel, services, and advanced shell implementation
rtech-technologies Feb 25, 2026
8a4ac1c
feat: cooperative userspace loader in shell 'run' command; add DEVELO…
rtech-technologies Feb 25, 2026
4d31d35
tools: add mk_rsl utility and build_rsl.sh helper to create RSL binar…
rtech-technologies Feb 25, 2026
fd6e37e
feat(shell): support .apl text scripts — run executes each line as sh…
rtech-technologies Feb 25, 2026
6ae35cd
feat(shell): variables, expansion, and simple if-blocks for .apl scripts
rtech-technologies Feb 25, 2026
d5a99ee
feat(runtime): add userspace runtime program and make shell.run prefe…
rtech-technologies Feb 25, 2026
ff65a2b
feat(fs): add RRDFS and FAT stubs; use RRDFS in fs; build runtime.rsl…
rtech-technologies Feb 25, 2026
1cb8fad
feat: implement scrolling, shift support, and advanced shell
google-labs-jules[bot] Feb 27, 2026
b316561
feat: transition to RTECH Standard Library (RSL) for program development
google-labs-jules[bot] Feb 28, 2026
42aabc1
feat: implement Python-like ARC memory model and RSL system language
google-labs-jules[bot] Mar 1, 2026
a94dd52
feat: implement self-sustaining RSL and noob-friendly expert shell
google-labs-jules[bot] Mar 1, 2026
0e0e612
feat: reorganize kernel into libs and unice64 per expert rules
google-labs-jules[bot] Mar 3, 2026
087c7aa
feat: ultimate expert freestanding reorganization with ARC and self-s…
google-labs-jules[bot] Mar 4, 2026
1e35019
feat: ultimate v1.0 expert OS with Auto-RAM, advanced colors, and pro…
google-labs-jules[bot] Mar 4, 2026
4578a96
feat: implement LFS-style configuration utility and RNAFS disk manager
google-labs-jules[bot] Mar 5, 2026
9940e88
feat: implement MBR partitioning and proprietary RNAFS partition support
google-labs-jules[bot] Mar 5, 2026
5f6058b
feat: implement True GPT 64-bit partitioning and disk management
google-labs-jules[bot] Mar 5, 2026
e91887f
fix: force kernel load to 0x200000 and heap to 0x1000000
google-labs-jules[bot] Mar 6, 2026
a1a993f
feat: implement two-stage handover and God-mode kernel
google-labs-jules[bot] Mar 7, 2026
350c5a9
feat: implement professional advanced configuration system and build …
google-labs-jules[bot] Mar 7, 2026
4b4880b
Implement OSx2 (RTECH dos) modular two-stage architecture.
google-labs-jules[bot] Mar 7, 2026
1940914
Finalize OSx2 (RTECH dos) modular kernel with functional MenuConfig.
google-labs-jules[bot] Mar 7, 2026
85448ed
Finalize OSx2 (RTECH dos) Modular Kernel Architecture.
google-labs-jules[bot] Mar 8, 2026
c07d0bb
Add CODEBASE.md documentation and finalize OSx2 architecture.
google-labs-jules[bot] Mar 8, 2026
4b9b951
Finalize OSx2 (RTECH dos) Professional Modular Kernel Architecture.
google-labs-jules[bot] Mar 8, 2026
44e7725
Finalize OSx2 (RTECH dos) Professional Modular Kernel Architecture.
google-labs-jules[bot] Mar 8, 2026
5e1b6db
Finalize OSx2 (RTECH dos) Professional Architecture and Storage Virtu…
google-labs-jules[bot] Mar 8, 2026
e493470
Resolve #UD exception and stabilize OSx2 storage virtualization.
google-labs-jules[bot] Mar 9, 2026
3b7885a
Finalize OSx2 (RTECH dos) Professional Architecture and Technical Doc…
google-labs-jules[bot] Mar 10, 2026
35494a3
Finalize exhaustive Technical Implementation Blueprint (CODEBASE.md).
google-labs-jules[bot] Mar 12, 2026
d485d88
Resolve gdt_init error and bridge linker address mismatch.
google-labs-jules[bot] Mar 13, 2026
dc60155
Implement 'Opaque Sheep' Two-Stage Handover (os2.bin).
google-labs-jules[bot] Mar 13, 2026
53ed4f3
Finalize 'Opaque Sheep' OS Architecture and Loader Stability.
google-labs-jules[bot] Mar 14, 2026
5bcc288
feat: implement forensic panic system and storage hardening
google-labs-jules[bot] Mar 14, 2026
b0cb8b6
feat: refactor kernel as native PE32+ EFI application
google-labs-jules[bot] Mar 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG_DEBUG_LOGS=y
CONFIG_KERNEL_BASE=0x100000
CONFIG_HEAP_BASE=0x2000000
CONFIG_HEAP_SIZE_MB=8
CONFIG_SCROLL_SPEED=10
CONFIG_EMERALD_MODE=y
CONFIG_FG_COLOR=0xff88
CONFIG_BG_COLOR=0x0
CONFIG_LOAD_SHELL=y
CONFIG_OPTIMIZATION=0
CONFIG_STRICT_CHECKS=y
55 changes: 55 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# OSx2 (RTECH dos) Architecture Rules

## 1. Directory Structure
- `/boot`: UEFI bootloader types and linker scripts.
- `/include`: Public headers and RSL (RTECH Standard Library) definitions.
- `/kernel/unice64`: Core kernel logic and entry points (mains).
- `/kernel/libs`: Internal kernel services and drivers.
- `/programs`: User-space programs (e.g., shell).

## 2. Kernel Lifecycle (The Ritual)
- `main.c` is strictly an orchestrator. It must NOT contain hardware, filesystem, or memory logic.
- Services are registered via `register_service(InitFunction)`.
- The kernel uses an event-driven flow:
- `EVENT_INIT`: Service initialization and setup.
- `EVENT_MAIN`: Main event loop execution.
- `EVENT_CLEANUP`: Shutdown preparation.
- `EVENT_EXIT`: Final termination.

## 3. RSL (RTECH Standard Library)
- RSL is the native system language for OSx2.
- Programs must include ONLY `<rsl.h>` and never internal kernel headers.
- High-level APIs like `readline()` and `color()` are provided for ease of use.

## 4. Memory Model (ARC & Managed RAM)
- OSx2 implements an Automatic Reference Counting (ARC) system for managed heap objects.
- High-level RSL functions (e.g., `readline`, `str_create`) return managed pointers with an initial ref-count of 1.
- Developers use `retain()` to increment and `release()` to decrement reference counts.
- **Note:** In the current v0.x implementation, the backing store is a high-speed bump allocator. While ref-counts are tracked, memory is not yet recycled for reuse. Manual `release()` calls are currently required for future-proofing and consistency with the RSL standard.

## 5. Storage Architecture (/CONNECT & VDISK)
- **Source of Truth**: The `/CONNECT` registry tracks all physical storage (Platters, RAM, USB).
- **Physical nodes**: Each device node has a configuration defining its Sector Size and Total LBA.
- **VDISK Suit**: A Virtual Disk abstraction layer that provides relative LBA access.
- **Signature Handshake**: VDISKs must contain the `0xDEADBEEF` signature at LBA 0 to be considered valid for mounting.
- **Error Handling**: Missing hardware or signature mismatches trigger a `CANNOT FIND DISK` or `Access Denied` error.

## 5. Console & Input
- Console supports full vertical scrolling and manual 8x8 font rendering to the GOP framebuffer.
- Advanced color selection is supported via `color(fg, bg)`.
- Input uses a freestanding PS/2 keyboard driver with Shift support.

## 6. Build Rules
- NO precompiled binaries or object files are allowed in the repository.
- The system must be buildable from pure source using the provided `Makefile`.
- Use `make menuconfig` to configure the kernel features and heap settings.

## 7. Forensic Panic System
- In the event of a fatal loader or kernel error, the system enters an "Autopsy" state.
- CPU registers (RAX-R15) are captured and displayed alongside error messages and status codes.
- Diagnostic data is mirrored to the serial COM1 port (0x3f8) for headless monitoring and logging.

## 8. Development Tools
- `tools/fontgen.html`: A pro-grade web studio to draw fonts and preview colors.
- `scripts/menuconfig.py`: Terminal-based configuration utility (LFS-style).
- `scripts/rnafs_tool.py`: Host-side tool to manage RNAFS disk images and inject files.
79 changes: 79 additions & 0 deletions CODEBASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# OSx2 (RTECH dos) Technical Implementation Blueprint (CODEBASE.md)

This document provides an exhaustive, low-level technical specification of the OSx2 codebase. It describes the implementation logic of every file with enough detail to allow for a complete system reconstruction.

---

## 1. Boot & Entry Layer (`/kernel/unice64`)

### `kernel/unice64/efi_entry.c` (Native UEFI Entry)
- **Purpose**: The "Native Diplomat". Serves as the PE32+ entry point for the firmware.
- **In-Code Logic**:
- **Initialization**: Calls `InitializeLib` (gnu-efi) to setup the UEFI environment.
- **Protocols**:
- Locates `EFI_GRAPHICS_OUTPUT_PROTOCOL` (GOP) to extract the linear framebuffer address, resolution, and scanline width into a `boot_params_t` struct.
- Handles `LOADED_IMAGE_PROTOCOL` and `SIMPLE_FILE_SYSTEM_PROTOCOL` to open the boot volume.
- **File Loading**: Loads `shell.bin` from the ESP into a 48MB fixed memory location (`0x3000000`).
- **Environment Prep**: Allocates memory for the ARC heap and the system ramdisk using `AllocatePages`.
- **The Transition**: Calls `ExitBootServices` to terminate UEFI's control over the hardware, then immediately calls `kernel_main` (passing the populated `boot_params_t`).

---

## 2. Kernel Core Layer (`/kernel/unice64`)

### `kernel/unice64/main.c` (The Orchestrator)
- **Purpose**: Kernel initialization, service registry, and event loop.
- **In-Code Logic**:
- **GDT Reset**: Calls `gdt_init` to re-establish segment descriptors for 64-bit mode after exiting UEFI services.
- **Service Registry**: Iterates through `registered_services` (Console, Memory, Input, FS, etc.) and calls their init functions.
- **Syscall Bridge**: Populates `rsl_syscall_table_t` with function pointers to kernel services.
- **Execution**: Hands over control to the user-space shell by calling `loader_run_shell`.
- **Event Loop**: Enters a `while(running)` loop that triggers `EVENT_MAIN`, allowing for asynchronous background processing.

### `kernel/unice64/gdt.c`
- **Purpose**: CPU segmentation for long mode.
- **In-Code Logic**: Defines a static GDT with Null, Code, and Data descriptors. Loads the GDT using the `lgdt` instruction to ensure the kernel runs in a controlled environment.

---

## 3. Kernel Services Layer (`/kernel/libs`)

### `kernel/libs/connect.c`
- **Purpose**: Physical hardware inventory. Maintains a registry of memory-mapped I/O and RAM regions.

### `kernel/libs/vdisk.c`
- **Purpose**: Storage virtualization layer. Translates virtual LBA requests to physical offsets on the ramdisk or other hardware.

### `kernel/libs/memory.c` (ARC System)
- **Purpose**: Reference-counted memory management.
- **In-Code Logic**: Implements a 'Free List' allocator on top of the UEFI-allocated heap. `alloc` returns ref-counted pointers; `release` decrements the count and returns the block to the free list if it hits zero.

### `kernel/libs/diskman.c`
- **Purpose**: Partition management. Parses GPT (GUID Partition Table) headers and manages VDISK partition mapping.

### `kernel/libs/rnafs.c` (Proprietary FS)
- **Purpose**: Contiguous filesystem on VDISKs.
- **In-Code Logic**: Uses a bitmap for block management. `rnafs_write` performs contiguous allocation and updates the directory entries. Fixed a critical bug where overwrites leaked blocks; it now deallocates old blocks before re-writing.

### `kernel/libs/console.c`
- **Purpose**: Graphics-mode text rendering. Draws 8x8 font characters directly to the GOP framebuffer.

### `kernel/libs/kutils.c` & `kutils.h`
- **Purpose**: Internal utility library. Uses `k_` prefixes (e.g., `k_memcpy`, `k_memset`) to avoid naming collisions with gnu-efi/UEFI symbols.

---

## 4. User Programs Layer (`/programs`)

### `programs/libsystem.c`
- **Purpose**: RTECH Standard Library (RSL) implementation for user-space. Caches the syscall table passed by the kernel.

### `programs/shell.c`
- **Purpose**: Native OSx2 Shell. Provides an interactive interface for file management and system commands.

---

## 5. Build System (`Makefile`)

- **Architecture**: Links all kernel components into a single `kernel.so` shared object, which is then converted to a `BOOTX64.EFI` application using `objcopy`.
- **Emulation**: Uses `qemu-system-x86_64` with the Q35 chipset and OVMF firmware to provide a modern UEFI boot environment.
127 changes: 127 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# OSx2 (RTECH dos) Root Makefile - Native UEFI Edition

CC = gcc
LD = ld
OBJCOPY = objcopy

# Load Configuration
-include .config

# Set defaults if not configured
CONFIG_KERNEL_BASE ?= 0x100000
CONFIG_HEAP_BASE ?= 0x2000000
CONFIG_OPTIMIZATION ?= 0

# Paths
BOOT_DIR = boot
EFI_DIR = $(BOOT_DIR)/EFI/BOOT
KERNEL_DIR = kernel/unice64
LIBS_DIR = kernel/libs

# GNU-EFI Paths
EFI_LIB = /usr/lib
EFI_LDS = /usr/lib/elf_x86_64_efi.lds
EFI_CRT0 = /usr/lib/crt0-efi-x86_64.o

# Flags
# Use EFI flags for the entire kernel now
CFLAGS_EFI = -Iinclude -fno-stack-protector -mno-red-zone -Wall -fno-builtin -m64 -O$(CONFIG_OPTIMIZATION) \
-fpic -fshort-wchar -DEFI_FUNCTION_WRAPPER -I/usr/include/efi -I/usr/include/efi/x86_64 -I/usr/include/efi/protocol

LDFLAGS_EFI = -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -L $(EFI_LIB) $(EFI_CRT0)
LDFLAGS_SHELL = -nostdlib -T programs/linker.ld --oformat binary

LIBS_EFI = -lefi -lgnuefi

# Source Files
KERNEL_OBJS = $(KERNEL_DIR)/efi_entry.o \
$(KERNEL_DIR)/main.o \
$(KERNEL_DIR)/gdt.o \
$(LIBS_DIR)/kutils.o \
$(LIBS_DIR)/console.o \
$(LIBS_DIR)/font_data.o \
$(LIBS_DIR)/input.o \
$(LIBS_DIR)/connect.o \
$(LIBS_DIR)/vdisk.o \
$(LIBS_DIR)/disk.o \
$(LIBS_DIR)/diskman.o \
$(LIBS_DIR)/memory.o \
$(LIBS_DIR)/fs.o \
$(LIBS_DIR)/rnafs.o \
$(LIBS_DIR)/loader.o \
$(LIBS_DIR)/core/event.o

SHELL_SRCS = programs/libsystem.c programs/shell.c
SHELL_OBJS = $(SHELL_SRCS:.c=.o)

HEADERS = $(shell find include kernel -name "*.h")

# Default Target
all: info prepare $(EFI_DIR)/BOOTX64.EFI $(BOOT_DIR)/shell.bin

info:
@echo "------------------------------------------------"
@echo " OSx2 / RTECH dos Build System (Native UEFI)"
@echo " Optimization Level: -O$(CONFIG_OPTIMIZATION)"
@echo "------------------------------------------------"

prepare:
@if [ ! -f .config ]; then \
python3 scripts/menuconfig.py --save; \
fi

menuconfig:
@python3 scripts/menuconfig.py

# Unified Kernel (Native EFI App)
$(EFI_DIR)/BOOTX64.EFI: kernel.so
@mkdir -p $(EFI_DIR)
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
-j .rodata* --target=efi-app-x86_64 kernel.so $(EFI_DIR)/BOOTX64.EFI

kernel.so: $(KERNEL_OBJS)
$(LD) $(LDFLAGS_EFI) $(KERNEL_OBJS) -o kernel.so $(LIBS_EFI)

$(KERNEL_DIR)/%.o: $(KERNEL_DIR)/%.c $(HEADERS)
$(CC) $(CFLAGS_EFI) -c $< -o $@

$(LIBS_DIR)/%.o: $(LIBS_DIR)/%.c $(HEADERS)
$(CC) $(CFLAGS_EFI) -c $< -o $@

$(LIBS_DIR)/core/%.o: $(LIBS_DIR)/core/%.c $(HEADERS)
$(CC) $(CFLAGS_EFI) -c $< -o $@

# Programs (Still raw binary for simplicity in loading)
$(BOOT_DIR)/shell.bin: $(SHELL_OBJS)
$(LD) $(LDFLAGS_SHELL) $(SHELL_OBJS) -o $(BOOT_DIR)/shell.bin

programs/%.o: programs/%.c $(HEADERS)
$(CC) -Iinclude -fno-stack-protector -mno-red-zone -Wall -fno-builtin -m64 -ffreestanding -c $< -o $@

# Advanced Tools: Create Bootable UEFI Disk Image
disk: all
@echo "Creating bootable UEFI disk image..."
dd if=/dev/zero of=disk.img bs=1M count=64
mformat -i disk.img -F -v "OSX2" ::
mmd -i disk.img ::/EFI
mmd -i disk.img ::/EFI/BOOT
mcopy -i disk.img $(EFI_DIR)/BOOTX64.EFI ::/EFI/BOOT/BOOTX64.EFI
mcopy -i disk.img $(BOOT_DIR)/shell.bin ::/shell.bin
@echo "OSx2 Pro UEFI Disk Image Ready (disk.img)."

run: disk
qemu-system-x86_64 -machine q35 -bios /usr/share/ovmf/OVMF.fd -drive format=raw,file=disk.img -m 256M -serial stdio -net none

setup:
sudo apt-get update
sudo apt-get install -y gnu-efi build-essential qemu-system-x86 ovmf mtools dosfstools

# Cleanup
clean:
@find . -name "*.o" -delete
@rm -f kernel.so $(BOOT_DIR)/shell.bin disk.img
@rm -rf $(BOOT_DIR)/EFI
@echo "Build artifacts removed."

.PHONY: all clean disk prepare menuconfig info run
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

18 changes: 18 additions & 0 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef CONFIG_H
#define CONFIG_H

/* Auto-generated by OSx2 menuconfig Professional */

#define CONFIG_DEBUG_LOGS 1
#define CONFIG_KERNEL_BASE 0x100000
#define CONFIG_HEAP_BASE 0x2000000
#define CONFIG_HEAP_SIZE_MB 8
#define CONFIG_SCROLL_SPEED 10
#define CONFIG_EMERALD_MODE 1
#define CONFIG_FG_COLOR 0xff88
#define CONFIG_BG_COLOR 0
#define CONFIG_LOAD_SHELL 1
#define CONFIG_OPTIMIZATION 0
#define CONFIG_STRICT_CHECKS 1

#endif
82 changes: 82 additions & 0 deletions include/rsl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#ifndef RSL_H
#define RSL_H

#include "types.h"

/*
* RTECH Standard Library (RSL)
* The ultimate system language for OSx2 / RTECH dos.
*/

typedef struct {
uint32* framebuffer;
uint32 width;
uint32 height;
uint32 pixels_per_scanline;
void* ramdisk_base;
uint64 ramdisk_size;
void* shell_base;
uint64 shell_size;
void* heap_base;
uint64 heap_size;
void* SystemTable;
void* ImageHandle;
} boot_params_t;

typedef struct {
void (*print)(const char*);
void (*input)(const char*, char*, uint64);
INTN (*fread)(const char*, void*, uint64);
INTN (*fwrite)(const char*, const void*, uint64);
void* (*alloc)(uint64);
void (*retain)(void*);
void (*release)(void*);
void (*exit)();
void (*clear)();
void (*set_color)(uint32 fg, uint32 bg);

void (*format)(int);
void (*mount)(int);
void (*addpart)(uint64, uint32);
void (*lsfs)();
} rsl_syscall_table_t;

/* --- High-Level "Noob-Friendly" API --- */
void print(const char* str);
char* readline(const char* prompt);
void clear();
void quit();
void color(uint32 fg, uint32 bg);

/* Disk & Partition Management */
void format(int idx);
void mount(int idx);
void addpart(uint64 start, uint32 count);
void lsfs();

/* --- Auto-RAM: Managed Memory API --- */
void* auto_ram(uint64 size);
void release(void* ptr);
void retain(void* ptr);

/* --- String Utilities --- */
char* str_create(const char* init);
int strcmp(const char* s1, const char* s2);
int strncmp(const char* s1, const char* s2, uint64 n);
void strcpy(char* dst, const char* src);
void strncpy(char* dst, const char* src, uint64 n);
uint64 strlen(const char* s);
char* strchr(const char* s, int c);

/* --- Memory & Files --- */
void* alloc(uint64 size);
void memcpy(void* dst, const void* src, uint64 n);
void memset(void* s, int c, uint64 n);
INTN read_file(const char* path, void* buffer, uint64 max_size);
INTN write_file(const char* path, const void* buffer, uint64 size);

/* --- Numeric Utilities --- */
int atoi(const char* s);
void itoa(int n, char* s, int base);

#endif
Loading