This document explains how to port Chrysalis OS to new architectures, platforms, or environments.
Chrysalis OS is built with strict separation between generic kernel code and architecture-specific implementations, making porting feasible without rewriting the entire system.
Status: Supported
Mode: 32-bit protected mode
Boot: Multiboot / Multiboot2 (GRUB)
Implemented subsystems:
- GDT / IDT
- Paging & Virtual Memory
- Physical Memory Manager
- PIC, APIC, IOAPIC
- SMP (multi-core)
- ACPI
- HPET
- PCI
- Framebuffer graphics
- Interrupt-driven drivers
All architecture-specific code lives under:
kernel/arch/<arch>/
Example:
kernel/arch/i386/
├── boot/
├── cpu/
├── gdt/
├── idt/
├── irq/
├── paging/
├── apic/
├── smp/
├── switch.S
Generic kernel code must never directly depend on architecture details.
To support a new architecture (e.g. x86_64, ARM, RISC-V), the following must be implemented.
- CPU entry point
- Stack initialization
- Early identity mapping
- Transfer control to
kernel_main
- Interrupt enable/disable
- Exception handling
- Context save/restore
- Safe task switching
- Physical memory detection
- Paging / MMU setup
- Virtual address space management
- IRQ delivery mechanism
- Timer interrupts
- Device interrupt routing
One reliable monotonic timer:
- HPET-equivalent
- Platform timer
- CPU-provided counter
Minimum required devices:
- Serial or framebuffer console
- Keyboard / input abstraction
- Block storage device
These subsystems are architecture-independent and should not require changes:
- Scheduler
- VFS and filesystems
- Process/task model
- Shell
- UI stack (Compositor, Window Manager, FlyUI)
- Serial output (early debugging)
- Boot to
kernel_main - Exceptions and interrupts
- Memory management
- Timer
- Basic input
- Storage
- Graphics
- SMP (optional)
Potential future ports:
- x86_64 (long mode)
- ARMv7 / ARMv8
- RISC-V (RV32)
These are not implemented upstream.
Chrysalis OS is released under the MIT License.
You are free to:
- Create new architecture ports
- Maintain downstream forks
- Distribute custom builds
Please credit the original project when redistributing.
End of file