Skip to content

PandaKing2021/Minium-Operation-System-For-Study

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal OS - Educational Operating System

A simple, clean, and educational operating system designed for beginners to learn OS development concepts.

Features

  • 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

Project Structure

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

Building

Prerequisites

  • GCC (cross-compiler for i386 or host with 32-bit support)
  • GNU Binutils (as, ld)
  • GRUB tools (grub-mkrescue or grub2-mkrescue)
  • Make

Build Commands

# Build the OS and create ISO image
make

# Clean build files
make clean

# Remove all generated files
make distclean

This will create minimal_os.iso which can be booted in a virtual machine.

Running

Using QEMU (Recommended)

# Build and run in QEMU
make run

# Or manually:
qemu-system-i386 -cdrom minimal_os.iso

Using VirtualBox

  1. Create a new virtual machine
  2. Set OS type: Other/Unknown
  3. Mount minimal_os.iso as CD/DVD
  4. Start the VM

Using VMware

Similar process to VirtualBox - mount the ISO and boot from it.

Available Commands

Once the OS boots, you'll see a command prompt. Type help to see available commands:

  • help - Display available commands
  • ls - List files in current directory
  • cd <dir> - Change directory
  • pwd - Print working directory
  • cat <file> - Display file contents
  • mkdir <dir> - Create directory
  • touch <file> - Create empty file
  • rm <name> - Remove file or directory
  • clear - Clear screen
  • reboot - Reboot system

Learning Resources

Code Organization

  1. boot.S: Assembly code that sets up the stack and calls kernel main
  2. kernel.c: Initializes subsystems and starts the shell
  3. io.c: Low-level I/O operations for screen and keyboard
  4. fs.c: Implements a simple tree-based file system
  5. shell.c: Parses and executes commands

Key Concepts

  • 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

Development

Adding New Commands

To add a new command:

  1. Open src/kernel/shell.c
  2. Add the command to the commands array
  3. Implement the command function
  4. Rebuild with make

Modifying the Kernel

The kernel is designed to be simple and educational:

  • All code uses English comments
  • Functions are well-documented
  • Structure follows typical OS organization

System Requirements

  • x86 or x86_64 processor
  • 4MB RAM minimum
  • Virtual machine (QEMU, VirtualBox, VMware)

License

This is an educational project. Feel free to use, modify, and learn from it.

Troubleshooting

Build Errors

  • "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
  • "cannot create regular file": Ensure you have write permissions

Boot Issues

  • Make sure the ISO is properly generated
  • Check virtual machine settings (enable legacy BIOS boot if needed)
  • Try different virtualization software

Contributing

This is a learning project. Feel free to:

  • Add new features
  • Improve documentation
  • Fix bugs
  • Share your modifications

Author

PandaKing

Acknowledgments

  • Inspired by various OS development tutorials
  • Uses GRUB as bootloader
  • Built with standard GNU toolchain

About

A minium operation system for study,includes booting,input&output,file system,command lines,dma control,etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors