Operating system written for educational purposes



  • A Linux machine, since this was developed on Ubuntu 18.04
  • Maybe a Mac will work, but I’m not sure.

Environment setup

  • Install a machine emulator like qemu.

Installing a kernel crosscompiler

(Instructions taken from here)

  • Install the following packages from apt:

    • libgmp3-dev
    • libmpfr-dev libmpfr-doc libmpfr6
    • libmpc-dev
    • gcc
    • texinfo
    • lib64ncurses5-dev
  • Import the following paths:

export PREFIX="/usr/local/i386elfgcc"
export TARGET=i386-elf
export PATH="$PREFIX/bin:$PATH"
  • Install binutils by following the given steps:
mkdir /tmp/src
cd /tmp/src
curl -O # If the link 404's, look for a more recent version
tar xf binutils-2.24.tar.gz
mkdir binutils-build
cd binutils-build
../binutils-2.24/configure --target=$TARGET --enable-interwork --enable-multilib --disable-nls --disable-werror --prefix=$PREFIX 2>&1 | tee configure.log
make all install 2>&1 | tee make.log # If there is a permission denied error, use sudo
  • Install gcc by following these steps:
cd /tmp/src
curl -O
tar xf gcc-4.9.1.tar.bz2
mkdir gcc-build
cd gcc-build
../gcc-4.9.1/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --disable-libssp --enable-languages=c --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc
  • Install gdb using the following instructions:
cd /tmp/src
curl -O
tar xf gdb-7.8.tar.gz
mkdir gdb-build
cd gdb-build
export PREFIX="/usr/local/i386elfgcc"
export TARGET=i386-elf
../gdb-7.8/configure --target="$TARGET" --prefix="$PREFIX" --program-prefix=i386-elf-
make install

Running the OS image

  • To simply run the OS:
make run
  • To run the OS in debug mode:
make debug



You can see the notes taken while working on this project in this repo: makhanOS/notes.