A minimal operating system with a basic file system and shell interface.
- Bootable from USB drive
- Simple in-memory file system
- Basic shell with commands:
ls- List directory contentscd- Change directorymkdir- Create directorypwd- Print working directoryclear- Clear screenhelp- Show available commandsuptime- Show system uptimeecho- Display text
You need a cross-compiler for i386-elf target. Follow these steps to set it up:
-
Install build dependencies: ``` sudo apt-get install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo libisl-dev ```
-
Build the cross-compiler (this may take some time): ``` git clone https://github.com/cfenollosa/os-tutorial.git cd os-tutorial/toolchain ./build.sh ```
-
Add the cross-compiler to your PATH: ``` export PATH=$PATH:$HOME/opt/cross/bin ```
-
Clone the repository: ``` git clone https://github.com/yourusername/MinimalOS.git cd MinimalOS ```
-
Build the OS: ``` make ```
-
Create a bootable USB image: ``` make usb ```
-
Write the image to a USB drive (replace /dev/sdX with your USB device): ``` sudo dd if=minimalos.img of=/dev/sdX bs=4M status=progress ```
You can test the OS in QEMU without creating a USB drive:
``` make run ```
boot/- Bootloader codecpu/- CPU-specific code (GDT, IDT, etc.)drivers/- Hardware drivers (keyboard, screen, etc.)fs/- File system implementationinclude/- Header fileskernel/- Kernel codelibc/- C library functionsshell/- Shell implementation
-
Boot the OS from USB:
- Insert the USB drive into the computer
- Restart the computer and enter the boot menu (usually F12, F2, or ESC)
- Select the USB drive to boot from
-
Once booted, you'll see the MinimalOS shell prompt: ``` MinimalOS Shell v1.0 Type 'help' for a list of commands
minimalos> ```
-
Demonstrate file system commands: ``` minimalos> mkdir test Directory created: test
minimalos> ls Contents of /: [DIR] test
minimalos> cd test
minimalos> pwd /test
minimalos> mkdir subdir Directory created: subdir
minimalos> ls Contents of /test: [DIR] subdir
minimalos> cd ..
minimalos> pwd / ```
-
Show other commands: ``` minimalos> uptime System uptime: 42 seconds
minimalos> echo Hello, MinimalOS! Hello, MinimalOS!
minimalos> clear ```
-
Bootloader: Explain how the bootloader loads the kernel into memory and switches to 32-bit protected mode.
-
File System: Describe the in-memory file system implementation that supports basic directory operations.
-
Shell Interface: Show how the shell processes commands and interacts with the file system.
-
Device Drivers: Mention the keyboard and screen drivers that enable user interaction.
-
Memory Management: Discuss the memory management utilities and how they're used in the OS.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.