CS350 Container
This is CS350 Docker container repository. It includes the CS350 Docker container and the tools to build, run, debug and test OS/161 and Linux based programming assignments for CS350. This repository currently expects that you are running in a UNIX or UNIX-like environment that supports docker, such as, MacOS, Linux or Windows WSL.
If you have a Windows system without WSL, then start here.
If you do not have access to a UNIX or UNIX-like environment then you can use the older instructions to build, run, debug and test in University of Waterloo's linux student environment.
Windows - Prerequistes to install a UNIX-like environment and Docker
UNIX and UNIX-like Environments - Prerequiste to install Docker
- Install docker
Prerequiste - repository for OS/161 source code
-
This repository assumes that you have a copy of the OS/161 source code on the local machine.
-
You should have a remote repository to manage your OS/161 source code and move between the local and linux.student environments.
-
If you do not currently have a working copy of os161, you can retrieve your own by copying the
os161.tar.gz
file withinos161-container/dependencies
directory in the cs350-container repository.
cp os161-container/dependencies/os161.tar.gz ~/
cd ~/
tar xzvf os161.tar.gz
You should now have a folder called os161-1.99
in your home directory. Make this a git repository!
Prerequiste complete - install CS350-container
Once the above requirements are met, make sure docker desktop is running (if on WSL or MacOS), then you can clone this repository and install the cs350-container by typing:
sudo ./install.sh
In a terminal from within the project directory. This script will pull the assignments reposiroty and build it into a local copy of the os161-runner image.
Running OS161 in the cs350-container
To start using the container you use the run.sh script, which takes one argument -- the directory of your working code repository.
sudo ./run.sh ~/os161-1.99
Once executed you will be within the context of the container itself (its like your own mini environment), there are two functions (found at /helpers.sh within the container), build_kernel ASST#
, and test_kernel ASST#
. Where the #
represents the
assignment number. You can run these commands from the shell container. These functions are preloaded in your shell. For example, to build and run ASST0:
# build_kernel ASST0
# test_kernel ASST0
If you would like to run the kernel normally (no scripts), once built, you can run the kernel
# cd /os-compile
# sys161 kernel
You can evaluate your assignment based on public test cases. There will be hidden test cases that are not avaiable in this repository.
# /evalaute /logs/test_public.log /assignments/ASST0
There also exists a clean_kernel ASST#
command which will try and clean up old builds, this may be necessary if running into issues. If this
fails that is okay (means there was no build to begin with), just run build_kernel ASST#
as normal.
Running GDB
- Make sure you have built the kernel using
build_kernel ASST0
. - To run GDB, open a terminal with the cs350-container running, and enter the following commands:
# cd /os-compile/
# sys161 -w kernel
- Now in another terminal, move to the project directory and use the
./connect.sh
script to connect to the previosuly running container:
# cd /os-compile/
# cs350-gdb kernel
# cd os-compile/
# cs350-gdb kernel
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
...
(gdb) dir /kernel/kern/compile/ASST0
...
You will need to use the command dir /kernel/kern/compile/ASST#
where #
is the assignment number. This will make sure to load the symbols
of the kernel. Symbols are the names we have given functions and variables. This allows gdb to correctly convey what you are looking at, since the kernel has been compiled WITH these symbols, otherwise gdb will show just bare assembly!
Note: If run.sh fails it means there is still a os161-runner container running. Use docker kill os161
to kill it.
Running other assignments
You may point the run.sh
in any directory, the script makes sure that the directory is shared between the container and you. Allowing you to
continue to code and work on the files within the directoy and have the container running and seeing those changes. Further instructions will
be given to the scripts used to run and evaluate userspace code.
When mounting other directories that are not os161 note that the build_kernel
and test_kernel
functionality will not work.
Layout
There are some noted directories within the container
-
/kernel
holds YOUR assignment code -
/os161-1.99
holds unchanged os161 kernel code -
/os-compile
holds the compiled version of the code -
/assignments
holds testing and evaluation scripts used for each assignment
Within the /assignments
directory there are subdirectories for each assignment, which you can review:
- the
public
file - shows the test cases we pass and use, - the
run.sh
file - how we run and build your assignment, - the
verify.py
script - how we evaluate the output of your assignment.
If the assignments repo has changed, either due to assignments being changed or bugs found (found at os161-container/assignments
) you will need to just run sudo ./install.sh
again.