{"id":31724955,"url":"https://github.com/rajarohan/myos","last_synced_at":"2025-10-09T05:16:58.165Z","repository":{"id":316362163,"uuid":"1063038775","full_name":"rajarohan/myos","owner":"rajarohan","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-24T07:15:56.000Z","size":2816,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T07:20:17.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rajarohan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T04:52:16.000Z","updated_at":"2025-09-24T07:16:00.000Z","dependencies_parsed_at":"2025-09-24T07:20:25.044Z","dependency_job_id":"905c82bc-74d8-4738-85ff-0e86c3b6cc70","html_url":"https://github.com/rajarohan/myos","commit_stats":null,"previous_names":["rajarohan/myos"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rajarohan/myos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajarohan%2Fmyos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajarohan%2Fmyos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajarohan%2Fmyos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajarohan%2Fmyos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rajarohan","download_url":"https://codeload.github.com/rajarohan/myos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajarohan%2Fmyos/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000741,"owners_count":26082933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-09T05:16:55.475Z","updated_at":"2025-10-09T05:16:58.157Z","avatar_url":"https://github.com/rajarohan.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MyOS - A Simple Operating System with File System\n\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)]()\n[![Platform](https://img.shields.io/badge/platform-x86-lightgrey.svg)]()\n\nMyOS is a simple, educational operating system kernel written in C and Assembly that demonstrates fundamental OS development concepts. It features a custom in-memory hierarchical file system with full text file management capabilities through an interactive command-line shell interface.\n\n## Features\n\n### 🖥️ Core System\n- **32-bit x86 kernel** with multiboot compliance\n- **GRUB bootloader** support for easy booting\n- **VGA text mode** with color support and scrolling\n- **Keyboard driver** with full US QWERTY layout support\n\n### 📁 File System\n- **Hierarchical directory system** with Unix-like structure\n- **File operations**: create, read, write, delete, and list files\n- **Directory operations**: mkdir, rmdir, cd, pwd navigation\n- **Path resolution**: support for absolute (/) and relative (.., .) paths\n- **Custom in-memory file system** with up to 64 files and directories\n- **Text file support** with up to 1KB per file\n- **Real-time file management** through interactive commands\n\n### 🖱️ User Interface\n- **Interactive shell** with command-line interface\n- **Color-coded output** for better user experience\n- **Command history** and error handling\n- **Help system** with detailed command documentation\n\n## Quick Start\n\n### Prerequisites\n\nMake sure you have the following tools installed:\n\n- **Cross-compiler toolchain**: `x86_64-elf-gcc` and `x86_64-elf-ld`\n- **GRUB tools**: `i686-elf-grub-mkrescue` for bootable ISO creation\n- **QEMU**: `qemu-system-i386` for OS testing and emulation\n- **Make**: Build automation tool\n- **Homebrew** (on macOS) for package management\n\n### Installation on macOS\n\n```bash\n# Install cross-compilation tools\nbrew install x86_64-elf-gcc qemu grub\n\n# Verify installation\nx86_64-elf-gcc --version\nqemu-system-i386 --version\ni686-elf-grub-mkrescue --version\n\n# Clone and build the project\ngit clone https://github.com/rajarohan/myos.git\ncd myos\n\n# Build and run in one command\nmake run\n```\n\n### Building and Running\n\n```bash\n# Build the OS kernel\nmake\n\n# Create bootable ISO image\nmake kernel.iso\n\n# Run in QEMU emulator (recommended)\nmake run\n\n# Clean all build artifacts\nmake clean\n\n# Force rebuild everything\nmake clean \u0026\u0026 make run\n```\n\n### Build Process Details\n\nThe build system:\n1. Compiles C source files with the cross-compiler (`x86_64-elf-gcc`)\n2. Assembles the boot code (`boot.S`) for multiboot compliance\n3. Links everything using the custom linker script (`linker.ld`)\n4. Creates a GRUB-bootable ISO image with `i686-elf-grub-mkrescue`\n5. Launches the OS in QEMU emulator\n\n## Usage\n\nOnce MyOS boots, you'll see the interactive shell with the prompt `myos\u003e`. Here are the available commands:\n\n### File Management Commands\n\n| Command | Alias | Description | Example |\n|---------|-------|-------------|---------|\n| `create \u003cfile\u003e` | - | Create a new text file | `create hello.txt` |\n| `read \u003cfile\u003e` | `cat` | Display file contents | `read hello.txt` |\n| `write \u003cfile\u003e` | `edit` | Write text to file | `write hello.txt` |\n| `delete \u003cfile\u003e` | `rm` | Delete a file | `delete hello.txt` |\n\n### Directory Management Commands\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `mkdir \u003cdir\u003e` | Create a new directory | `mkdir documents` |\n| `rmdir \u003cdir\u003e` | Remove an empty directory | `rmdir documents` |\n| `cd \u003cpath\u003e` | Change directory (/, .., dirname) | `cd documents` |\n| `pwd` | Show current directory path | `pwd` |\n| `list` | `ls` | List directory contents | `list` |\n\n### System Commands\n\n| Command | Description | Example |\n|---------|-------------|---------|\n| `help` | Show all available commands | `help` |\n| `clear` | Clear the screen | `clear` |\n| `info` | Show file system information | `info` |\n\n### Example Session\n\n```\nMyOS File System Shell v1.0\n============================\n\nFile system with directory support initialized successfully.\n\nType 'help' for available commands.\n\nmyos:/$ mkdir documents\nDirectory 'documents' created successfully.\n\nmyos:/$ mkdir photos  \nDirectory 'photos' created successfully.\n\nmyos:/$ list\nContents of /:\nType Name                    Size (bytes)\n----------------------------------------\nDIR  documents               \u003cDIR\u003e\nDIR  photos                  \u003cDIR\u003e\n\nTotal: 2 items\n\nmyos:/$ cd documents\nChanged to directory: /documents\n\nmyos:/documents$ create hello.txt\nFile 'hello.txt' created successfully.\n\nmyos:/documents$ write hello.txt\nEnter text for file 'hello.txt' (press Ctrl+D or empty line to finish):\nHello, World!\nThis is my first file in the documents folder!\n\nData written to file 'hello.txt' (50 bytes).\n\nmyos:/documents$ list\nContents of /documents:\nType Name                    Size (bytes)\n----------------------------------------\nFILE hello.txt               50\n\nTotal: 1 items\n\nmyos:/documents$ read hello.txt\nContents of 'hello.txt':\n--- BEGIN FILE ---\nHello, World!\nThis is my first file in the documents folder!\n--- END FILE ---\n\nmyos:/documents$ cd ..\nChanged to directory: /\n\nmyos:/$ pwd\n/\n\nmyos:/$ info\n\nFile System Information:\nCurrent Directory: /\nTotal entries: 3/64\nDirectories: 2, Files: 1\nData used: 50/65536 bytes\nFree space: 65486 bytes\n```\n\n## Architecture\n\n### Project Structure\n\n```\nmyos/\n├── src/\n│   ├── kernel.c        # Main kernel entry point\n│   ├── boot.S          # Assembly boot code with multiboot header\n│   ├── vga.c/h         # VGA text mode driver with color support\n│   ├── keyboard.c/h    # PS/2 keyboard input driver\n│   ├── filesystem.c/h  # Hierarchical in-memory file system\n│   └── shell.c/h       # Interactive command shell with directory support\n├── boot/\n│   └── grub.cfg        # GRUB configuration\n├── linker.ld           # Linker script for memory layout\n├── Makefile            # Cross-compilation build system\n└── README.md           # This file\n```\n\n### Technical Details\n\n- **Target Architecture**: x86 32-bit (i386)\n- **Bootloader**: GRUB with multiboot specification\n- **Memory Model**: Flat memory model with 16KB kernel stack\n- **Display**: VGA text mode (80x25 characters, 16 colors)\n- **Input**: PS/2 keyboard with scan code translation\n- **File System**: Simple allocation table with linear data storage\n\n## Development\n\n### Building from Source\n\nThe build system uses a cross-compilation toolchain to generate 32-bit x86 code:\n\n1. **Compile C sources** to object files\n2. **Assemble boot code** with multiboot header\n3. **Link kernel** using custom linker script\n4. **Create ISO image** with GRUB bootloader\n5. **Run in emulator** for testing\n\n### Memory Layout\n\n```\n0x00100000 (1MB)  : Kernel start (multiboot header)\n0x00101000        : Text section (.text)\n0x00102000        : Read-only data (.rodata)\n0x00103000        : Data section (.data)\n0x00104000        : BSS section (.bss)\n0x00105000+       : Kernel stack and heap\n```\n\n### File System Design\n\nThe file system uses a simple design with:\n\n- **File Allocation Table**: Array of file entries with metadata\n- **Data Area**: Linear storage for file contents\n- **Memory Management**: Simple bump allocator for file data\n- **Maximum Capacity**: 32 files, 1KB each (32KB total)\n\n## Contributing\n\nContributions are welcome! Here are some ideas for enhancements:\n\n### Potential Features\n- [ ] Persistent file system (disk storage)\n- [ ] Directory support\n- [ ] File permissions and attributes\n- [ ] Process management and multitasking\n- [ ] Network stack implementation\n- [ ] Device driver framework\n- [ ] Memory management unit (MMU) support\n\n### Getting Started\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test thoroughly in QEMU\n5. Submit a pull request\n\n## Educational Value\n\nThis project demonstrates key operating system concepts:\n\n- **Kernel Development**: Low-level system programming\n- **Bootloading**: Understanding system startup process\n- **Device Drivers**: Hardware abstraction and I/O\n- **File Systems**: Data organization and storage\n- **Memory Management**: Allocation and addressing\n- **User Interfaces**: Command-line interaction design\n\n\n## Acknowledgments\n\n- **OSDev Wiki** for excellent OS development resources\n- **GRUB Project** for the bootloader\n- **QEMU Project** for emulation capabilities\n- **GNU Toolchain** for cross-compilation tools\n\n## Troubleshooting\n\n### Common Issues\n\n**Error: `x86_64-elf-gcc: No such file or directory`**\n```bash\n# Install the cross-compiler toolchain\nbrew install x86_64-elf-gcc\n# Verify installation\nwhich x86_64-elf-gcc\n```\n\n**Error: `no multiboot header found`**\n- Ensure `boot.S` contains the multiboot header magic numbers\n- Verify the linker script places `.multiboot` section at the beginning\n- Check that boot.o is the first object file in linking order\n\n**Error: `i686-elf-grub-mkrescue: command not found`**\n```bash\n# Install GRUB tools\nbrew install grub\n# Verify GRUB installation\ni686-elf-grub-mkrescue --version\n```\n\n**QEMU doesn't start or crashes**\n```bash\n# Ensure QEMU is properly installed\nbrew install qemu\nqemu-system-i386 --version\n\n# Run with explicit ISO path\nqemu-system-i386 -cdrom ./kernel.iso\n\n# Try with additional memory\nqemu-system-i386 -cdrom kernel.iso -m 256M\n```\n\n**Build fails with linker errors**\n```bash\n# Clean and rebuild\nmake clean\nmake\n\n# Check for missing object files\nls -la *.o\n```\n\n### Debug Mode\n\nFor development and debugging:\n```bash\n# Run QEMU with monitor console for debugging\nqemu-system-i386 -cdrom kernel.iso -monitor stdio -no-reboot\n\n# Build with debug symbols\nmake clean\nCFLAGS=\"-g -DDEBUG\" make\n\n# Enable verbose output during build\nmake V=1\n```\n\n### Performance Tuning\n\n```bash\n# Run with hardware acceleration (if available)\nqemu-system-i386 -cdrom kernel.iso -enable-kvm\n\n# Allocate more memory to the VM\nqemu-system-i386 -cdrom kernel.iso -m 512M\n\n# Use multiple CPU cores\nqemu-system-i386 -cdrom kernel.iso -smp 2\n```\n\n## Contact\n\n- **GitHub**: [@rajarohan](https://github.com/rajarohan)\n- **Project**: [MyOS Repository](https://github.com/rajarohan/myos)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajarohan%2Fmyos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frajarohan%2Fmyos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajarohan%2Fmyos/lists"}