cfenollosa_os-tutorial/23-fixes/README.md

88 lines
3.4 KiB
Markdown
Raw Normal View History

run commands below to set up env
- `brew install nasm qemu gcc`
- `brew tap nativeos/i386-elf-toolchain`
- `brew install i386-elf-binutils i386-elf-gcc`
2015-08-17 16:41:38 +00:00
cd to /23-fixes, then you can compile and run `make run`
2015-08-17 16:41:38 +00:00
make sure run `make clean && make run` if you change any code.
2015-08-17 16:41:38 +00:00
--------------------
Purpose of the Operating System
This operating system is designed to demonstrate fundamental OS concepts and basic system functionality. The primary purpose is to:
2015-08-18 08:14:06 +00:00
Command Interface: Implement a simple shell interface for user interaction
Resource Management: Demonstrate basic memory management and system resource tracking
File Operations: Simulate basic file system operations like rename and move
2015-08-18 08:14:06 +00:00
The OS boots from a custom bootloader, initializes hardware components, and provides a command-line interface for user interaction.
Implemented Functions
2015-08-18 08:14:06 +00:00
1. LIST Command
2015-08-18 08:31:28 +00:00
Purpose: Displays all available commands in the system
Implementation: Iterates through a command table and prints each command with its description
Code Location: kernel/kernel.c - cmd_list() function
2015-08-18 08:31:28 +00:00
2. CLEAR Command
2015-08-18 08:31:28 +00:00
Purpose: Clears the terminal screen
Implementation: Writes blank spaces to the entire video memory buffer and resets cursor position
Code Location: drivers/screen.c - clear_screen() function
2015-08-18 08:31:28 +00:00
3. ECHO Command
2015-08-18 09:44:24 +00:00
Purpose: Echoes user input back to the screen
Implementation: Parses input string after "ECHO" keyword and prints it
Use Case: Testing input/output functionality
Code Location: kernel/kernel.c - cmd_echo() function
2015-08-18 09:44:24 +00:00
4. RENAME Command
2015-08-18 08:14:06 +00:00
Purpose: Demonstrates file renaming capability
Implementation: Maintains a simple file table and updates file names
Code Location: kernel/kernel.c - cmd_rename() function
2015-08-18 09:02:06 +00:00
5. MOVE Command
2015-08-18 09:02:06 +00:00
Purpose: Simulates moving files between directories
Implementation: Parses source and destination paths and simulates file movement
Code Location: kernel/kernel.c - cmd_move() function
2015-08-18 08:14:06 +00:00
Technical Implementation Details
2015-08-18 08:14:06 +00:00
Bootloader: Custom x86 bootloader that loads the kernel into memory
Kernel: Monolithic kernel design with integrated drivers
Memory Management: Basic flat memory model with simple allocation
Interrupt Handling: Implements IDT for keyboard and timer interrupts
Display Driver: Direct VGA text mode manipulation at 0xB8000
2015-08-18 09:44:24 +00:00
Screenshots: https://zaq7nm9t6b.feishu.cn/docx/L2rIdweXwoehnvxBxlhcZ5kKn9d?from=from_copylink
2015-08-18 09:44:24 +00:00
Code Statistics
2015-08-18 09:44:24 +00:00
Total Lines of Code: ~2,500 lines
Original Tutorial Code: ~2,000 lines
New Functions Added: ~500 lines
Languages Used: C (85%), Assembly (15%)
Files Modified: 8 files
New Functions Created: 5 major functions
2015-08-18 08:14:06 +00:00
Challenges and Learning Outcomes
The main challenges included understanding low-level hardware interaction, implementing proper interrupt handling, and managing memory without standard library support. This project provided valuable insights into:
2015-08-18 08:14:06 +00:00
How operating systems boot and initialize
Direct hardware manipulation
The importance of system calls and kernel/user space separation
Basic command parsing and execution
2015-08-28 08:52:05 +00:00
Future Improvements
Potential enhancements could include:
2015-08-28 08:52:05 +00:00
Implementing a real file system (FAT12 or custom)
Adding process management and multitasking
Implementing virtual memory with paging
Adding network stack support
2015-08-17 16:41:38 +00:00
Conclusion
This project successfully demonstrates core OS functionality through practical implementation. The system boots reliably, handles user input, and executes multiple commands, meeting all project requirements while providing a foundation for further OS development.