The OS/161 Kit

  • OS/161
  • System/161
  • Development Tools

OS/161

OS/161 is the kernel and software suite that is developed on for this course.

System/161

System/161 is a simulated MIPS system that the OS/161 operating system runs on. It emulates a MIPS R2000/R3000 CPU.

Development Tools

  • bmake - make for os161
  • os161-gcc - Compiles files to a MIPS binary format
  • os161-* - Other OS/161 related tools

Installation

At the time of writing this (February 19th 5:35PM), the course's personal development environment install guide wasn't accessible. EDIT: Nevermind, I had to log in... aha....

0) Create support directory

1
mkdir -p ~/cs3231/root

1) Install the build toolchain

We need a few things to compile the software.
What you may need will depend on what you already have on your machine.

OS/161 Utilities

These contain the os161- prefixed compiler tools

If you care to know which ones...

  • os161-addr2line
  • os161-ar
  • os161-as
  • os161-c++filt
  • os161-cpp
  • os161-elfedit
  • os161-gcc
  • os161-gcc-4.8.3
  • os161-gcc-ar
  • os161-gcc-nm
  • os161-gcc-ranlib
  • os161-gcov
  • os161-gdb
  • os161-ld
  • os161-ld.bfd
  • os161-nm
  • os161-objcopy
  • os161-objdump
  • os161-ranlib
  • os161-readelf
  • os161-run
  • os161-size
  • os161-strings
  • os161-strip

File: os161-utils_2.0.8.deb

1
2
3
4
5
6
7
andrew ::  sudo dpkg -i os161-utils_2.0.8.deb 
          Selecting previously unselected package os161-utils.
          (Reading database ... 222960 files and directories currently installed.)
          Preparing to unpack os161-utils_2.0.8.deb ...
          Unpacking os161-utils (2.0.8) ...
          Setting up os161-utils (2.0.8) ...
          Processing triggers for man-db (2.8.7-3) ...

os161-gdb

Create shortcut .gdbinit file

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cat > ~/cs3231/root/.gdbinit << :EOF
set can-use-hw-watchpoints 0
define connect
dir ~/cs3231/asst0-src/kern/compile/ASST0
target remote unix:.sockets/gdb
b panic
end
:EOF

echo "set auto-load safe-path /" >> ~/.gdbinit

libmpfr4

Getting this error during compilation?
error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory

MPFR provides a library for multiple-precision floating-point computation with correct rounding. The computation is both efficient and has a well-defined semantics. It copies the good ideas from the ANSI/IEEE-754 standard for double-precision floating-point arithmetic (53-bit mantissa).

My Ubuntu 19.10 installation doesn't have the libmpfr4 package available in its APT repository anymore, so I had to make a dirty hack to link the somewhat-backwards-compatible newer version to the old version.

sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4

// TODO Make better?

bmake

sudo apt install bmake

ncurses

sudo apt install libncurses5

2) Get the source code

1
2
cd ~/cs3231
git clone https://z8888888@gitlab.cse.unsw.EDU.AU/COMP3231/20T1/z8888888-asst0.git asst0-src

(Replacing 8888888 with your zID)

3) Configure

1
2
cd asst0-src
./configure

4) (B)Make

1
bmake

5) Install

1
bmake install

6) Build the OS/161 Kernel

1
2
3
4
5
6
7
cd ~/cs3231/asst0-src/kern/conf
./config ASST0

cd ../compile/ASST0
bmake depend
bmake
bmake install

7) Create a rebuild script

1
2
3
4
5
6
7
8
9
cat > ~/cs3231/asst0-src/rebuild.sh << :EOF
#!/bin/bash
cd "$(dirname "$0")"
cd kern/compile/ASST0
echo "Building..."
bmake && bmake install
:EOF

chmod a+x rebuild.sh

Now we can rebuild easily with ./rebuild!