Skip to content

Instantly share code, notes, and snippets.

@johnramsden
Forked from gerito1/OS161_set-up.md
Created September 9, 2019 03:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnramsden/176ce0adf43539b9422d9443df559bb0 to your computer and use it in GitHub Desktop.
Save johnramsden/176ce0adf43539b9422d9443df559bb0 to your computer and use it in GitHub Desktop.
A simple guide to have running the os161 kernel in Arch Linux

A simple guide to have running the os161 kernel in Arch Linux

This are some notes for the course OS 161 from ops-class.org (based on the OS 161 course from Harvard).

#Geting started

You will need some tools. A nice Text Editor or a fancy IDE for C, I usually go for gedit, or sometimes vim.

Then you will need to install all the toolchain for the course plus some other tools

yaourt -S mips-harvard-os161-binutils mips-harvard-os161-gcc48 mips-harvard-os161-gdb sys161 bmake git wget

The first three (*-binutils *-gcc48 *-gdb) are the assembler, linker, crosscompiler and the debugger that will help you to develop the OS.

sys161 It's the simulator for the Mips Architecture that will run the OS.

bmake is a bsd version of make, in general you will have GNUMake in your system, but it uses different syntax so you need bmake to build the system.

git is a program for version control, you should know.

wget it's a tool to download things.

#Get the sources

Go to the folder you want to download the sources for the kernel and use git

cd ~/src
git clone https://github.com/ops-class/os161.git

The symbol ~ is a short hand for my home directory /home/user, so that's equivalent to cd /home/user/src

Now this creates the folder os161 inside of /home/user/src

#Configure the OS

Now we need to configure the OS so bmake can build all the things.

Go to the main directory of your sources

cd /home/user/src/os161

So this time we need to call the configure script, as you can see if you use ls there is configure. It only takes one parameter --ostree this indicates were we want bmake put all the things. In general you want this in the root subdirectory.

./configure --ostree=$(realpath ./root)

realpath takes an argument and append the whole rute of your current directory in this case /home/user/src/os161/root

After run configure, a new file defs.mk is created.

#Configure the Kernel

We not only need to configure the OS, we need to configure the kernel too. We need to go to the Kernel's configuration subdirectory.

cd kern/conf

And tell the configure script what kind of configuration we want. For the Assignature 0, ASST0 we want DUMBVM

./config DUMBVM

#Making all the things

Now we need to call bmake. We will need three steps. One to make all the dependencies, make the kernel and move all the files to the appropiated location (the osstree we defined before).

We need to go to the compile directory of our kernel.

cd ../compile/DUMBVM

And make make make all the things.

First all the dependencies.

bmake depend

If no error, now we need to make the kernel

bmake

And again if no errors move the things, in this case we need to run bmake install

bmake install

If everything went fine, now we have our vm almost ready to run.

Go to the root directory or the directory you defined as osstree

cd ../../../root

#Run the Simulator

Now there's only one more thing to do, we need a more configuration file, that will set some parameters for our simulator.

Make sure you are in the root subdiretory of the os161 folder and download the configuration file.

wget https://www.ops-class.org/files/sys161.conf

With everything set up, just fire the Simulator

sys161 ./kernel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment