CS 450 Project 1B: xv6 (Kernel Hacking) Warmup

Overview

The project description can be found here. Your task is the same as outlined on that page (namely, adding a system call). You should also read the background notes and you can take a look at the video linked on that page. Please be advised, though, that they are using a slightly different version of the xv6 kernel, and their handout and handin procedures are different, so there will be minor differences. Please do not follow their testing notes, as ours are different (see below).

Notes

This project should be done alone! Copying code (from others) is considered cheating. If we detect plagiarized code, severe penalties will be applied. Please do us all a favor and do your own work (otherwise, why are you here?).

Getting the Starter Code

As before, you should go to the Github classroom link posted in Piazza. You should accept the invitation and then go to the link it gives you, and follow the same clone procedure as you did in Project 1A to get the code for xv6. Once you get your code, you can then start building and running in a container.

I have provided a Docker container for your use in the xv6 directory. You should use it the same way you did in the previous project, namely:

            
[you@machine] git clone https://github.com/IIT-CS450-F20/p1b-xv6-warmup-yourid
[you@machine] cd p1b-xv6-warmup-yourid
[you@machine] docker build . --tag p1b
[you@machine] docker run -it --volume $PWD:/p1b p1b bash
            
            
If you have a Linux machine, you can do it without Docker, but you'll likely need to install some packages, i.e., python and QEMU. You can also install a Linux VM using VirtualBox or VMware if you prefer. The easiest route though is likely Docker since you won't need to worry about installing packages. Windows 10 we've found to be particularly annoying for getting docker working, so be careful with copy and pasting the above commands. For example, if you're using Powershell on Windows, the docker run command would look more like:

            
[you@machine] docker run -it --volume ${PWD}:/p1b p1b bash
            
            

I believe for Cygwin you'll want something more like:

            
[you@machine] docker run -it --volume "%cd%":/p1b p1b bash
            
            

Windows Docker is especially picky about spaces in file paths, so if you're getting a weird error like "invalid reference format" check your full path.

Running xv6

To run xv6, you can do the following, first to build the kernel, then to run it in QEMU (a fast emulator):

            
[root@container] make
[root@container] make qemu-nox
            
            

If this works, congrats! You've now booted a kernel (xv6) inside a container! You can try to play around with the available commands like ls etc. but you wont be able to do a whole lot else. You can hit ctrl-a followed by x to exit QEMU.

Testing Your Code

You can test your xv6 code by using make. We will have a separate suite of tests for each xv6 project. To invoke the tests for this part, you can run:

            
[root@container] make test-p1b
            
            

Or if you want the tests to continue without stopping on failures, run:

            
[root@container] make test-p1b-cont
            
            
Make sure to test often, and be sure that your code passes all tests before handing your code in. You will only get credit for tests that you pass.

Due Dates and Logistics

This project is due Friday, September 18, 2020 at 11:59PM. Late submissions will be penalized as per the syllabus.

Handing In

IMPORANT:Before you hand in, make sure to add (and commit) a file named "info.txt" which contains your full name and e-mail address. If I cannot associate your Github account with you, you cannot expect your code to be graded!

As you go, you should be making commits using git to your local repository (again, if you've not used git, you should go to the link above). When you're ready to hand in your code, you can just run:

            
[you@machine] make handin
            
            
If you have modified files you haven't commited, the handin script will warn you. This handin script actually just invokes git push.

Remember that you will be docked points for late work as per the syllabus.

Questions?

If you have questions, please first post them on Piazza so others can get the benefit of the instructor/TA's answer. Avoid posting code that will give away your solution or allow others to cheat. If this does not resolve your issue, contact the instructor or TA, or come to office hours.