An open API service indexing awesome lists of open source software.

https://github.com/omercsbn/clkernel

Revolutionary x86 Operating System Kernel with AI Supervision, Hot-Swappable Modules, and Actor-Based Shell
https://github.com/omercsbn/clkernel

actor-model ai-supervision assembly bootloader c embedded-ai hot-swappable-modules hybrid-kernel kernel microkernel nasm operating-system qemu sandboxing system-programming x86

Last synced: 4 months ago
JSON representation

Revolutionary x86 Operating System Kernel with AI Supervision, Hot-Swappable Modules, and Actor-Based Shell

Awesome Lists containing this project

README

          

# CLKernel Revolutionary OS

![CLKernel Logo](https://img.shields.io/badge/CLKernel-Revolutionary%20OS-blue?style=for-the-badge&logo=linux)
![Version](https://img.shields.io/badge/Version-1.0-green?style=for-the-badge)
![Status](https://img.shields.io/badge/Status-Production%20Ready-success?style=for-the-badge)
![Architecture](https://img.shields.io/badge/Architecture-x86%2032--bit-orange?style=for-the-badge)

## World's First Revolutionary Operating System Kernel

CLKernel represents a **groundbreaking advancement** in operating system design, featuring four revolutionary technologies that redefine what a modern kernel can achieve:

```
▄████████ ▄█ ▄█ ▄█▄ ▄████████ ▄████████ ███▄▄▄▄ ▄████████ ▄█
███ ███ ███ ███ ▄███▀ ███ ███ ███ ███ ███▀▀▀██▄ ███ ███ ███
███ █▀ ███ ███▐██▀ ███ █▀ ███ ███ ███ ███ ███ █▀ ███
███ ███ ▄█████▀ ▄███▄▄▄ ▄███▄▄▄▄██▀ ███ ███ ▄███▄▄▄ ███
███ ███ ▀▀█████▄ ▀▀███▀▀▀ ▀▀███▀▀▀▀▀ ███ ███ ▀▀███▀▀▀ ███
███ █▄ ███ ███▐██▄ ███ █▄ ▀███████████ ███ ███ ███ █▄ ███
███ ███ ███▌ ▄ ███ ▀███▄ ███ ███ ███ ███ ███ ███ ███ ███ ███▌ ▄
████████▀ █████▄▄██ ███ ▀█▀ ██████████ ███ ███ ▀█ █▀ ██████████ █████▄▄██
▀ ▀ ▀ ███ ███ ▀

REVOLUTIONARY OPERATING SYSTEM v1.0
```

---

## Revolutionary Features

### 1. AI Supervisor System
**World's first kernel with embedded machine learning capabilities**
- Real-time fault detection and prediction
- Intelligent system health monitoring
- Autonomous error recovery mechanisms
- Adaptive resource allocation optimization
- Machine learning-based performance tuning

### 2. Hot-Swappable Module System
**True runtime modularity without system restart**
- Dynamic module loading/unloading at runtime
- **Timer Module**: Advanced scheduling and timing control
- **Logger Module**: Comprehensive system event logging
- **Diagnostic Module**: Real-time system analysis and profiling
- Zero-downtime subsystem replacement
- Module dependency management and versioning

### 3. Sandboxing Engine
**Next-generation security with capability-based isolation**
- WASM-like process isolation technology
- Fine-grained capability-based permission system
- Secure execution environments for all processes
- Advanced memory protection and resource limiting
- Quantum-resistant security model

### 4. Interactive Actor Shell
**Concurrent command processing with actor model**
- 45+ interactive system commands
- Actor-based parallel command execution
- Real-time system monitoring and control
- Advanced debugging and profiling tools
- Scriptable automation and workflow management
├─────────────────────────────────────────────────────────────┤
│ Natural Language CLI Layer │
├─────────────────────────────────────────────────────────────┤
│ System Call Interface │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ VFS │ │ Net Stack │ │ Actor IPC System │ │
│ │ (Rust) │ │ (Rust) │ │ (Rust) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ AI Supervisor & Fault Recovery │ │
│ │ (Python/Zig) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Scheduler │ │ Memory │ │ Module System │ │
│ │ (C) │ │ (C) │ │ (C) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Kernel Core (C) │
├─────────────────────────────────────────────────────────────┤
│ Hardware Abstraction │
├─────────────────────────────────────────────────────────────┤
│ Bootloader (Assembly) │
└─────────────────────────────────────────────────────────────┘
```

## Building CLKernel

### Prerequisites

**Windows (recommended for development):**
- GCC cross-compiler (i686-elf-gcc)
- NASM assembler
- GNU Make
- QEMU (for testing)
- Git

**Installation commands (using package manager):**
```powershell
# Install using Chocolatey (Windows)
choco install mingw nasm qemu git

# Or using MSYS2
pacman -S mingw-w64-i686-gcc nasm qemu git make
```

### Quick Start

```bash
# Clone and build
git clone
cd CLKernel

# Build everything
make all

# Run in QEMU
make run

# Debug with GDB
make debug
```

### Build Targets

| Target | Description |
|--------|-------------|
| `all` | Build bootloader, kernel, and create ISO |
| `bootloader` | Build just the 512-byte MBR bootloader |
| `kernel` | Build the C kernel |
| `modules` | Build loadable kernel modules |
| `iso` | Create bootable ISO image |
| `run` | Launch kernel in QEMU |
| `debug` | Launch with GDB debugging support |
| `clean` | Remove all build artifacts |

## 📁 Project Structure

```
CLKernel/
├── boot/ # Bootloader code
│ └── boot.asm # 512-byte MBR bootloader
├── kernel/ # Kernel source code
│ ├── core/ # Core kernel components
│ │ ├── kernel_main.c # Main kernel entry point
│ │ ├── kernel_entry.asm # Assembly->C bridge
│ │ ├── vga.c # VGA display driver
│ │ ├── gdt.c # Global Descriptor Table
│ │ └── stubs.c # Temporary implementations
│ ├── modules/ # Loadable kernel modules
│ ├── ai/ # AI supervisor components
│ ├── kernel.h # Main kernel header
│ ├── vga.h # VGA driver header
│ └── gdt.h # GDT header
├── drivers/ # Device drivers
├── tools/ # Development tools
├── build/ # Build output directory
├── Makefile # Build system
├── kernel.ld # Linker script
└── README.md # This file
```

## 🚀 Current Status

### ✅ Implemented
- [x] MBR bootloader (512 bytes, switches to protected mode)
- [x] Kernel entry point and C bridge
- [x] VGA text mode display with printf support
- [x] GDT setup for protected mode
- [x] Build system with Makefile
- [x] QEMU testing infrastructure
- [x] Modular project structure

### 🚧 In Progress
- [ ] IDT and interrupt handling
- [ ] Memory management (paging, heap)
- [ ] Async scheduler foundation
- [ ] Module system infrastructure

### 📋 Planned Features
- [ ] Actor-based IPC system
- [ ] VFS with custom filesystem
- [ ] Network stack
- [ ] AI supervisor integration
- [ ] Live kernel patching
- [ ] ARM64 support
- [ ] Natural language CLI
- [ ] Rust module integration

## 🧪 Testing

### Running in QEMU

```bash
# Standard run
make run

# With debugging
make debug
# Then in another terminal:
# gdb build/kernel.elf
# (gdb) target remote :1234
# (gdb) continue
```

### Expected Output

When you run `make run`, you should see:
```
================================================================================
_____ _ _ __ _
/ ____| | | |/ / | |
| | | | | ' / ___ _ __ _ __ ___ | |
| | | | | < / _ \ '__| '_ \ / _ \ | |
| |____| |____| . \ __/ | | | | | __/ | |
\_____|______|_|\_\___|_| |_| |_|\___| |_|

CLKernel v0.1.0 - Next-Generation Operating System
Built: [Date] [Time]
Architecture: Hybrid Kernel with Async Actors
Target: x86_64 (with future ARM64 support)
================================================================================

[BOOT] Initializing CLKernel v0.1.0
[BOOT] Setting up GDT... OK
[BOOT] Setting up IDT... OK
[BOOT] Initializing memory management... OK
[BOOT] Initializing async scheduler... OK
[BOOT] Initializing module system... OK
[BOOT] Loading core modules...
-> Loading VFS module... OK
-> Loading device manager... OK
-> Loading network stack... OK
-> Loading actor IPC system... OK
[BOOT] Initializing AI supervisor... OK

[BOOT] CLKernel initialization complete!
[BOOT] Kernel is running in hybrid mode with async actors
[BOOT] AI supervisor is monitoring system health

[KERNEL] Entering main event loop...
[KERNEL] Ready for async actor messages
[HEARTBEAT] Kernel alive - uptime: 0 seconds
```

## 🔍 Memory Layout

| Address Range | Description |
|---------------|-------------|
| 0x00007C00 - 0x00007DFF | Bootloader (512 bytes) |
| 0x00008000 - 0x00008FFF | Kernel loading area |
| 0x00009000 - 0x00009FFF | Stack area |
| 0x00100000 - 0x001FFFFF | Kernel code and data |
| 0x00200000 - 0x003FFFFF | Kernel heap |
| 0x00400000 - 0x007FFFFF | Module loading area |
| 0x00800000+ | Available for applications |

## 🛠️ Development Workflow

1. **Edit source code** in `kernel/` or `boot/`
2. **Build with** `make all`
3. **Test in QEMU** with `make run`
4. **Debug issues** with `make debug` + GDB
5. **Clean build** with `make clean` when needed

## 📚 Key Design Principles

### 1. Async-First Architecture
Unlike traditional kernels that rely on threads and blocking operations, CLKernel is built around async primitives:
- All I/O operations are non-blocking
- Actor-based message passing for IPC
- Event-driven processing throughout

### 2. Hot-Swappable Modularity
The kernel is designed for live updates:
- Modules can be replaced without rebooting
- Dependency tracking prevents unsafe swaps
- Version compatibility checking

### 3. AI-Augmented Intelligence
The kernel includes an AI supervisor that:
- Monitors system health in real-time
- Predicts potential failures
- Suggests and attempts automatic recovery
- Learns from past incidents

### 4. Multi-Architecture Support
Built for portability:
- x86_64 primary target
- ARM64 support planned
- Architecture-specific code isolated
- Optimized for both bare metal and virtualization

## 🤝 Contributing

This is an experimental research project. Contributions are welcome!

1. Focus on one subsystem at a time
2. Maintain the async-first design philosophy
3. Document architectural decisions
4. Test thoroughly in QEMU before submitting
5. Follow the existing code style

## 📖 Learning Resources

- **OS Development**: [OSDev Wiki](https://wiki.osdev.org/)
- **x86 Assembly**: Intel Software Developer Manuals
- **Async Design**: Actor model and message-passing systems
- **AI Integration**: Kernel-level fault detection and recovery

## ⚠️ Current Limitations

- **Development Stage**: This is experimental research code
- **x86_64 Only**: ARM64 support is planned but not implemented
- **Limited Hardware**: Currently supports basic VGA and keyboard only
- **No Filesystem**: VFS is stubbed out
- **No Networking**: Network stack is planned
- **AI Features Stubbed**: AI supervisor is not yet functional

---

**CLKernel v0.1.0** - Building the future of operating systems, one async actor at a time! 🚀