Friday, November 13, 2009

How to install and run OS161 in Linux

OS161 is a small Operating System which runs on System161. System161 is machine simulator which gives the perception of a required architecture using your current machine architecture, virtually. So without knowing much about its real hardware we can simply code for the simplified hardware architecture for OS161.

The details of OS161's can be found in its home, harvard university site.

So let's see how it can be installed in Linux. Installation is very easy if you can apply some commands correctly.

There are packages here we need to go with
  • BinUtils
  • gcc
  • gdb
  • system161
  • os161

Installation Procedure

Download the entire package from here.

Now go to the directory where you downloaded the file. In our case it is Desktop.


# cd Desktop


Now extract the packages

# tar xzvf ASST0.tar.gz

tar command extract or create archives,
x means extract,
z means gz compressed format,
v means verbose or recursive,
f means file

The extracted packages are also in tar.gz (gz is a method of compression and
tar is tarball format) format. Extract all of them.


# tar xzvf cs161-binutils-1.4.tgz
# tar xzvf cs161-gcc-1.4-2.tgz
# tar xzvf cs161-gdb-1.4-2.tgz
# tar xzvf sys161-1.12-2.tgz
# tar xzvf os161-1.11.tar.gz

Installing softwares in Linux from sources (source-codes) require 3 steps
(if anytime you need to install softwares from tar.gz etc format then this
process applies too).
  • ./configure to identify system environment and softwares etc
    configuration.
  • make command builds the executable program from the source code (this
    takes long time mostly)
  • Now it's time to install the program. By applying make install command
    we do this (this step requires root previlidge for most softwares though
    os161 does not require it)
Now for every package we need to apply the same procedure. So the commands
will be like this:


# cd cs161-binutils-1.4
# ./toolbuild.sh

This script configures makes and installs at the same time.

Let the next packages know the path of the executable files.


# export PATH=$PATH:$HOME/cs161/bin
# echo "PATH=$PATH:$HOME/cs161/bin" >> .bashrc
# echo "export PATH" >> .bashrc

As we have add the path in .bashrc. You never need to add the path to environment variable again.

Now install gdb and sys161. Then configure and install mipseb.


# cd ../cs161-gcc-1.4-2
# ./toolbuild.sh
# cd ../cs161-gdb-1.4-2
# ./toolbuild.sh
# cd ../sys161-1.12-2
# ./configure mipseb
# make
# make install

Now install OS161 and configure Assignment 0

# cd ../os161-1.11
# ./configure
# make
# cd kern/conf
# ./config ASST0
# cd ../compile/ASST0
# make depend
# make
# make install
# cd ~/cs161/root
# cp sys161.conf.sample sys161.conf
# ./sys161 kernel-ASST0

Press q to exit the kernel.

If you have tried all the procedures described here and still cannot get to the final boot screen of os161. Then use this automated shellscript. Download the shell script from here. After downloading this script apply these commands to run.


# chmod a+x OS161_install_script_v1.3.3.sh
# ./OS161_install_script_v1.3.3.sh

Details instructions here.

You might need to debug your programs while running in os161. You can use gdb. But for the first time you need a guideline on how to use gdb. Go to this link to get a short tutorial on gdb.

Hints on some assignments here.

2 comments:

  1. Thanks a lot.
    Great job. This worked fine for me.

    ReplyDelete
  2. Hey, welcome. I appreciate it.

    ReplyDelete