Setting Up your Environment

A Walkthrough

Files. All of the programs and files mentioned for the last part of the course can be found in the /courses/cs3410 directory in the CSUG (or in standard locations on most linux machines for things like xxd and cat). You should copy these files to your VM (for consistency sake, your home folder). You should also vary the server as to evenly distribute the load. Try your netid mod 15 for example. Specifically, in your VM terminal type:

  $ cd
  $ rsync -avzr netid@csug02.csuglab.cornell.edu:/courses/cs3410/mipsel-linux/* ./mipsel-linux
  $ rsync -avzr netid@csug02.csuglab.cornell.edu:/courses/cs3410/pa4-sim/* ./pa4-sim
  $ rsync -avzr netid@csug02.csuglab.cornell.edu:/courses/cs3410/pa4/* ./pa4
    

Permissions. Change the permissons of your pa4 directory using the following commands and do not change the permissions back. Failing to change the permissions of your pa4 directory as stated here is a violation of academic integrity.

  $ cd
  $ chmod -R g-rwxs pa4
  $ chmod -R o-rwx pa4
  $ chmod -R g-rwxs pa4-sim
  $ chmod -R o-rwx pa4-sim
	

$PATH. Now add these files to your PATH so that your shell knows where to find the ksimulate program and all of the mipsel-linux tools. This means that you can just type ksimulate as opposed to /home/[user]/pa4-sim/ksimulate every time you want to run something. In the following commands replace [user] with your username. If you are using the CSUG machines, use the appropriate paths (note you don't need to copy the files in that case)

Sublime Text + SFTP

Since this is a relatively large project, we highly recommend that you improve your workflow. The text editor Sublime Text is a really good tool that will make your life easy for most coding assignments throughout your undergrad years. If you are currently using Nano, you will love the switch to ST2. ST2 has a package manager that allows you to install a multitude of plugins for many different purposes.

To install the Package Manager, open Sublime Text and hit (Ctrl + `). Then paste the following lines in the bar that appears at the bottom of the screen:

import urllib2,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

Next, restart ST2. Once this is done, hit (Ctrl + Shift + P) or (Cmd + Shift + P) to open a dialog box. Type in "Install" and select the option "Install Package". Then type in SFTP and select the first option that comes up. This will install the SFTP package in Sublime.
Now, we need to setup the sftp connection from Sublime to your VM/CSUG. To do this, go into File > SFTP > Setup Server. This will open up a new file which you will save in a folder of your choosing. Edit the file to match your ssh configuration, and you're done! For more on how to use SFTP to create file, google is your friend, and so are the TAs!

Troubleshooting