- Notifications
You must be signed in to change notification settings - Fork30
A hobby operating system developed from scratch
License
MQuy/mos
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
mOS is the UNIX-like operating system developed from scratch and aims to be POSIX compliant.
- Filesystem
- Program loading
- UI (X11)
- Log
- Networking
- Signal
- Terminal
- mOS toolchain
- Port figlet
- Libc
- Port GNU Bash, Coreutils
- Unit testing
- Dynamic linker
- Port GCC (the GNU Compiler Collection)
- Browser
- Sound
- Symmetric multiprocessing
🍀 Optional features
- Setup 2-level paging in boot.asm
MacOS
install packages
$ brew install qemu nasm gdb i386-elf-gcc i386-elf-grub bochs e2fsprogs xorrisoopen your bash config and add lines below. Depending on your bash config, the file might be different. I use
ohmyzsh, so it is.zshrc# .zshrcalias grub-file=i386-elf-grub-filealias grub-mkrescue=i386-elf-grub-mkrescuerun emulator
$ cd src && mkdir logs$ ./create_image.sh && ./build.sh qemu isoopen another terminal
$ cd src$ gdb isodir/boot/mos.bin# in gdb(gdb) target remote localhost:1234(gdb) c
✍🏻 If you get this errorhdiutil: attach failed - no mountable file systems, installingextFS for MAC might help
Ubuntu
Install packakges
$ sudo apt install build-essential autopoint bison gperf texi2html texinfo qemu automake-1.15 nasm xorriso qemu-system-i386
Install gcc cross compilier viahttps://wiki.osdev.org/GCC_Cross-Compiler#The_Build
Install GCC (Version 9.1.0) & Binutils (Version 2.32).
Open src/toolchain/build.sh and modify SYSROOT and PREFIX variables to fit in your case
PREFIX="$HOME/opt/cross"TARGET=i386-pc-mos# SYSROOT cannot locate inside PREFIXSYSROOT="$HOME/Projects/mos/src/toolchain/sysroot"JOBCOUNT=$(nproc)Install mos toolchain
$ cd src/toolchain$ ./build.shRun Emulator
$ cd src && mkdir logs$ ./create_image.sh$ cd ports/figlet && ./package.sh && cd ../..$ cd ports/bash && ./package.sh make && cd ../..$ cd ports/coreutils && ./package.sh make && cd ../..$ ./build.sh qemu isoOpen another terminal
$ cd src$ gdb isodir/boot/mos.bin# in gdb(gdb) target remote localhost:1234(gdb) c
✍️ To get userspace address for debugging
$ i386-mos-readelf -e program# find the line below and copy Addr# [Nr] Name Type Addr Off Size ES Flg Lk Inf Al# [ x] .text PROGBITS xxx xxx xxx 00 AX 0 0 4Unit Test
$ cd test && git clone https://github.com/ThrowTheSwitch/Unity.git unity$ make clean && makeDebugging
inbuild.sh, adding-s -S right afterqemu to switch to debug mode. Currently, I use vscode +native debug -> click Run -> choose "Attach to QEMU"
Monitoring
by default, mOS logs output to terminal. If you want to monitor via file, doing following steps
# src/build.sh#L71-serial stdio↓-serial file:logs/uart1.log$ tail -f serial.log | while read line ; do echo $line ; done✍🏻 Usingtail in pipe way to color the output (like above) causes a delay -> have to manually save in the IDE to get latest changes
About
A hobby operating system developed from scratch
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.
