Skip to content

Improved Version of FOS for CSW355 using QEMU and VS Code

Notifications You must be signed in to change notification settings

yousinix/fos-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FOSv2

FOS is an educational OS for Ain Shams University Operating Systems Course CSW355, forked and refactored from MIT Operating Systems Lab 6.828. It was created by Dr. Mahmoud Hossam and currently maintained by Dr. Ahmed Salah.
FOSv2 is the next version of FOS. It provides a much faster and better environment using other editing and virtualization tools.

1. What's Different?

  1. No Eclipse! — Can be used with any text editor, defaults to Visual Studio Code.
  2. Uses QEMU instead of Bochs — QEMU is much faster, and needs less configuration files, also has better options.
  3. Independent source code — Separate the OS's code from its environment dependencies and build tools.
  4. No Leftovers — Remove JOS's leftovers from source code.
  5. Smaller size — Remove unused packages and files from the environment, 50% smaller than FOSv1.
  6. Open source — Allow contributions, improvements and bugs fixes, to make FOS better.

screenshot

2. Set up Environment

FOS needs an Linux environment to run as expected. For Windows users, the methods below try to mimic a Linux environment on Windows, choose any of them. For Linux users, just setup your environment as described below.

2.1. Windows - Cygwin

  1. Linux-like Environment:

    • Download and Install Cygwin 32-bit.
    • Copy setup-x86.exe to C:\cygwin.
    • Open a terminal in C:\cygwin and type:

      ./setup-x86.exe -q -P gdb,make,perl
  2. Toolchain:

    • Download the i386-elf-toolchain for Windows.
    • Extract i386-elf-toolchain-windows.rar in C:\cygwin\opt\cross\ (create this folder if it doesn't exist).
  3. Emulator:

    • Download and Install QEMU.
    • While installing, in the "Choose components" page uncheck all system emulations except i386.
  4. Update PATH:

    • Add the following to your PATH environment variable:

      C:\Program Files\qemu
      C:\cygwin\bin
      C:\cygwin\opt\cross\bin
      

2.2. Windows - WSL

Requires Windows 10 build 16215+

The Windows Subsystem for Linux lets developers run a GNU/Linux environment including most command-line tools, utilities, and applications directly on Windows, unmodified, without the overhead of a virtual machine.

  1. Open Control Panel > Programs > Turn Windows Features on or off > Check "Windows Subsystem for Linux".
  2. From Microsoft Store, download Ubuntu.
  3. Launch Ubuntu from your start menu.
  4. Set up your environment as described below in the Linux section. (Install missing tools if any command wasn't found.)

2.3. Linux

# Required Packages
sudo apt-get update
sudo apt-get install build-essential qemu-system-i386 gdb libfl-dev

# Create directory
sudo mkdir /opt/cross
cd /opt/cross

# Install Toolchain
sudo wget https://github.com/YoussefRaafatNasry/fos-v2/releases/download/toolchain/i386-elf-toolchain-linux.tar.bz2
sudo tar xjf i386-elf-toolchain-linux.tar.bz2
sudo rm i386-elf-toolchain-linux.tar.bz2

# Update your PATH in your ~/.bashrc file.
echo 'export PATH="$PATH:/opt/cross/bin"' >> ~/.bashrc

3. Setup Workspace

  1. Download and Install Visual Studio Code.
  2. Download or Clone* this repo and Open it in VS Code

    git clone https://github.com/YoussefRaafatNasry/fos-v2.git
    cd fos-v2/
    code .
  3. Install all recommended extensions from the bottom right corner.
  4. Run the build taskCtrl + Shift + B.

*Cloning is recommended to get the latest changes using git pull

4. Debugging

  1. Add breakpoints to your code.
  2. Start Debugging → F5.
  3. Fix your bugs!

5. Solve FOSv1 Assignments on FOSv2

FOSv2 has changed kern/Makefrag in 8e2612dc. This changes can cause errors after adding assignments' files (which usually conatin a kern/Makefrag file made for FOSv1). To solve this issue:

  1. Copy the assignments' files into your FOSv2 project (choose overwrite if prompted).
  2. Open the new kern/Makefrag and replace these lines by those ones.
    (or simply replace all occurences of $(OBJDIR)/kern/bochs.img by $(IMAGE))

6. Contribute

  • See the project's upcoming changes here.
  • Submit a PR with your requested changes. Contributions are always welcomed.
  • Submit an Issue if there's something wrong or unclear.