A simple, clean, and educational operating system designed for beginners to learn OS development concepts.
- Basic I/O: Text output to VGA display and keyboard input
- Command Line Interface: Simple shell with built-in commands
- File System: Tree-based in-memory file system
- Clean Architecture: Well-organized code structure for learning
os/
├── src/
│ ├── boot/
│ │ └── boot.S # Boot assembly code
│ └── kernel/
│ ├── kernel.c # Main kernel entry point
│ ├── kernel.h # Kernel header file
│ ├── io.c # I/O functions (keyboard, screen)
│ ├── fs.c # File system implementation
│ └── shell.c # Command line interpreter
├── Makefile # Build system (Linux/WSL)
├── linker.ld # Linker script
├── grub.cfg # GRUB configuration
├── build_linux.sh # Build script for Linux/WSL
├── build_windows.bat # Build script for Windows
├── BUILD_WINDOWS.md # Windows-specific build instructions
└── README.md # This file
- GCC (cross-compiler for i386 or host with 32-bit support)
- GNU Binutils (as, ld)
- GRUB tools (grub-mkrescue or grub2-mkrescue)
- Make
# Build the OS and create ISO image
make
# Clean build files
make clean
# Remove all generated files
make distcleanThis will create minimal_os.iso which can be booted in a virtual machine.
# Build and run in QEMU
make run
# Or manually:
qemu-system-i386 -cdrom minimal_os.iso- Create a new virtual machine
- Set OS type: Other/Unknown
- Mount
minimal_os.isoas CD/DVD - Start the VM
Similar process to VirtualBox - mount the ISO and boot from it.
Once the OS boots, you'll see a command prompt. Type help to see available commands:
help- Display available commandsls- List files in current directorycd <dir>- Change directorypwd- Print working directorycat <file>- Display file contentsmkdir <dir>- Create directorytouch <file>- Create empty filerm <name>- Remove file or directoryclear- Clear screenreboot- Reboot system
- boot.S: Assembly code that sets up the stack and calls kernel main
- kernel.c: Initializes subsystems and starts the shell
- io.c: Low-level I/O operations for screen and keyboard
- fs.c: Implements a simple tree-based file system
- shell.c: Parses and executes commands
- Multiboot Header: Required by GRUB to load the kernel
- VGA Text Mode: Direct memory access to video memory
- Keyboard Input: Reading from PS/2 keyboard port
- File System: In-memory tree structure for file management
To add a new command:
- Open
src/kernel/shell.c - Add the command to the
commandsarray - Implement the command function
- Rebuild with
make
The kernel is designed to be simple and educational:
- All code uses English comments
- Functions are well-documented
- Structure follows typical OS organization
- x86 or x86_64 processor
- 4MB RAM minimum
- Virtual machine (QEMU, VirtualBox, VMware)
This is an educational project. Feel free to use, modify, and learn from it.
-
"grub-mkrescue not found": Install GRUB tools
- Ubuntu/Debian:
sudo apt install grub-common grub-pc-bin - Fedora:
sudo dnf install grub2-tools - Arch:
sudo pacman -S grub
- Ubuntu/Debian:
-
"cannot create regular file": Ensure you have write permissions
- Make sure the ISO is properly generated
- Check virtual machine settings (enable legacy BIOS boot if needed)
- Try different virtualization software
This is a learning project. Feel free to:
- Add new features
- Improve documentation
- Fix bugs
- Share your modifications
PandaKing
- Inspired by various OS development tutorials
- Uses GRUB as bootloader
- Built with standard GNU toolchain