Home | Syllabus | Assignments | Resources | Piazza |
If you took CS61 this past Fall, then you already have the correct appliance installed, so you can skip directly to Installing the CS161 tools.
If you need to install the 2014 version of the CS50 appliance on your machine, follow these instructions.
Once you have your appliance running, open the terminal emulator (click on the screen icon next to the Chrome icon in the bottom tool bar). At the command line type:
update50Do not use any other means of updating software that comes with the appliance.
There are two ways you can use your CS50 appliance. You can use your appliance in the window that pops up when you start it up. Alternately, you can access it remotely from your host (real) computer via a network connection. Look at the bottom-right corner of the machine window. You will see an IP address, such as 192.168.166.128. You can ssh (or sftp) to this IP address as ssh jharvard@192.168.166.128. This way, you can treat the appliance as a server and edit files as you would on any remote server, either with an editor that can use sftp, such as TextWrangler or Notepad++, or using ssh and vim, emacs, nano, etc.
Copy this shell script (cs161.sh) onto your virtual machine (you can use scp or sftp to move files onto your VM, or just download from within the appliance with wget http://www.eecs.harvard.edu/~margo/cs161/resources/cs161.sh) and then execute it with source cs161.sh. (In case you didn't catch it when you updated your VM, the root password on the appliance is crimson.) Now, update your environment to find everything that was just built/installed either by a) closing your terminal window and opening a new one, or b) typing source .bashrc.
The script will take a while (several minutes), but it will install all the tools you will need for the course. You may be wondering just what all those tools are!
It should come as no surprise to you that we expect that you will need to use a debugger to complete assignments in this course. The good news is that just about everything you've learned about using gdb will apply to debugging OS/161. However, you may be wondering exactly how this is going to work since you will be building an operating system for something resembling a MIPS processor and you will be running on an Intel-based system.
We use a specially compiled version of gcc (and its associated tools) designed to produce code runnable on System/161. Thus, we have our own version of gcc (available as os161-gcc) and, among other things, our own version of gdb (available as os161-gdb).
For the most part, debugging your kernel will be no different from debugging any other program with gdb. There is a small caveat, however. Consider the following: the program that is actually running on your virtual machine will be System/161 (the executable will be called sys161). You don't want to debug System/161. You want to debug what is being run on System/161. Thus, a little cleverness is required.
You will have gdb communicate with System/161 through a Unix socket in order to send and receive debugging information. Thus, debugging your kernel generally takes three steps (after you've built your kernel, give this a try):
% sys161 -w kernel
% os161-gdb kernel
(gdb) target remote unix:.sockets/gdb
The handout Debugging with GDB provides a brief introduction to gdb and detailed instructions on how to debug your operating system with it.