CS350 Container
This is the CS350 Docker container that assists students who wish to have an isolated local environment for their os161 and userspace assignments. This repo currently expects that you are running in a UNIX environments that support docker (MacOS, Linux, or Windows WSL)
If you do not have access to this type of environment then you can use the older instructions for the provided student environments.
Windows
- Before you can install docker, you must have WSL installed.
- You can then install docker for WSL
Requirements
- Docker installed
- Your own working copy of os161 (if you do not have one see the next section)
Starting Fresh with OS161
If you are starting fresh and do not currently have a working copy of os161, you can retrieve your own by copying the
os161.tar.gz
file within os161-container/dependencies
directory.
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 repo!
Setup
Once the above requirements are met, you run:
sudo ./install.sh
From within the project directory. This script will pull the assignments repo and build it into a local copy of the os161-runner image.
Running OS161
To start using the container you use the run.sh script, which takes one argument -- the directory of your working code repo.
sudo ./run.sh ~/os161-1.99
Once executed you will be within the context of the container itself (its like your own mini environment), you will have preloaded two
ease of use functions (found at /helpers.sh within the container), build_kernel ASST#
, and test_kernel ASST#
. Where the #
signifies the
assignment number.
Within the container you may run within the shell (these functions are preloaded in your shell):
# build_kernel ASST0
# test_kernel ASST0
To build and run within the context of ASST0. Finally you may evaluate your assignment based off public test cases (there could be hidden ones not found within the repo)
# /evalaute /logs/test_public.log /assignments/ASST0
Running GDB
To run GDB, in a window with the container running and having built the kernel using the build_kernel ASST0
:
# cd /os-compile/
# sys161 -w kernel
Now in another terminal, move to this project directory and use the ./connect.sh
script to connect to the 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 convey what you are looking at (this is because
the kernel has been compiled WITH these symbols in mind), otherwise gdb will show just bare assembly!
Note: If ./connect.sh
does not work it may be because you have multiple running containers of os161-runner. Use docker ps
to figure this out.
This script is not a smart script just an ease of use script.
Running other assignments
You may point the run.sh
to any directory as all this does is 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, to see the test cases we pass and use, looks to the public
file,
to see how we run and build your assignment, see the run.sh
file. Finally, to see how we automatically evaluate the output of your assignment,
look at verify.py
If the assignments repo has changed, either due to assignments being changed or bugs found (found at os161-container/assignments
) you will need to pull this repo
and rebuild.
cd os161-container/assignments
git pull origin master
cd ../..
sudo docker build -t os161-runner os161-container