os/userland/shell.c with command system./run-os.sh to launch the OSThe shell now includes these commands:
./run-os.sh
make -f Makefile.os os-run
qemu-system-i386 -cdrom os/build/cubecactusos.iso -m 512M -serial stdio
When you run the OS, you'll see:
Initializing CubeCactusOS v0.1.0 Kernel version: 1.0 Initializing hardware... - Hardware initialized (stub) Initializing memory management... - Memory management initialized (stub) Initializing process management... - Process management initialized (stub) Initializing IPC subsystem... - IPC subsystem initialized (stub) Initializing system clock... - System clock initialized (stub) Kernel initialization complete. CubeCactusOS is now running! Entering scheduler... - Scheduler initialized ======================================== Welcome to CubeCactusOS Shell! ======================================== Type 'help' for available commands. cubecactusos# help CubeCactusOS Shell Commands: help - Show this help message about - Display OS information clear - Clear the screen (not implemented) echo - Echo text to screen mem - Display memory information uptime - Show system uptime (not implemented) reboot - Reboot the system (not implemented) shutdown - Shutdown the system (not implemented) cubecactusos# about CubeCactusOS v0.1.0 A microkernel-based operating system Based on MINIX3 architecture Built with: x86_64-elf-gcc Components: - Microkernel (IPC, scheduling) - Process Manager (PM) - Virtual File System (VFS) - TTY Driver cubecactusos# mem Memory Information: Total RAM: 512 MB (configured) Kernel Memory: ~10 KB Available: ~512 MB (Note: Memory management not fully implemented)
┌─────────────────────────────────┐
│ User Applications │
│ (Shell, Init, User Programs) │
└─────────────────────────────────┘
↕ System Calls
┌─────────────────────────────────┐
│ System Servers │
│ (PM, VFS, Network, etc.) │
└─────────────────────────────────┘
↕ IPC Messages
┌─────────────────────────────────┐
│ Device Drivers │
│ (TTY, Disk, Network, etc.) │
└─────────────────────────────────┘
↕ Hardware Access
┌─────────────────────────────────┐
│ Microkernel │
│ (IPC, Scheduling, Low-level) │
└─────────────────────────────────┘
↕ Hardware
┌─────────────────────────────────┐
│ Hardware (x86) │
└─────────────────────────────────┘
os/
├── boot/
│ ├── boot.S # Bootloader
│ ├── linker.ld # Linker script
│ └── grub.cfg # GRUB config
├── kernel/
│ ├── main.c # Kernel entry ✅ Updated
│ └── kernel.h # Kernel headers
├── lib/
│ └── klib.c # Kernel library (printf, etc.)
├── servers/
│ ├── pm.c # Process Manager
│ └── vfs.c # Virtual File System
├── drivers/
│ └── tty.c # TTY driver
├── userland/
│ ├── init.c # Init process
│ └── shell.c # Shell ✅ NEW!
└── build/
├── cubecactusos.bin # Kernel binary
└── cubecactusos.iso # Bootable ISO ✅
// In os/drivers/tty.c
// Implement keyboard interrupt handler
void keyboard_interrupt_handler() {
uint8_t scancode = inb(0x60);
// Convert scancode to character
// Send to shell input buffer
}
ls - List files (needs VFS)cat - Display file contentsps - Show processes (needs PM)kill - Kill processfree - Show memory usagecommand1 | command2Cause: Keyboard input not yet implemented Solution: This is expected. Keyboard driver coming soon!
Rebuild: make -f Makefile.os os-clean && make -f Makefile.os os-image
Check installation: which qemu-system-i386 Install: brew install qemu
You now have:
To run: ./run-os.sh
Great work! You've built a functioning OS with a shell! 🚀