Home Schedule Reading Projects People
Mac Logo Windows Logo Minix Logo Sun Solaris Logo Linux Logo

Project 2: GIMIX - Minix Setup

Assignment Day September 01, 2009
Due Date September 10, 2009 (Thursday)

Collaboration Policy - Read Carefully

You must work on this project individually, but you may discuss this assignment with other students in the class and ask and provide help in useful ways, preferable over our email list so we can all benefit from your great ideas. You may consult (but not copy) any outside resources you including books, papers, web sites and people (but no penguins or sea urchins).

If you use resources other than the class materials, indicate what you used along with your answer.

You have probably guessed it by now - every project will have a similar paragraph to the one above but with slight variations, of-course.

Objective:

The main objectives for this assignment are:

This tutorial/project is inspired by Darrel Long (and some materials are used by permission) and many others.

Tutorial / References

MINIX resources programming/tutorials:

There are several MINIX resources that I found useful.

http://en.wikipedia.org/wiki/MINIX_3 (see great links at bottom).

http://www.minix3.org/doc/A-312.html (outlines the process nicely)

http://wiki.minix3.org/en/UsersGuide/DoingInstallation (newer and above, but the first listed is still useful).

http://wiki.minix3.org/en/UsersGuide/RunningMinixOnVmware(insights on running MINIX on WMware.

http://www.minix3.org/manpages/index.html (Minix man pages)

VMWare resources programming/tutorials:

http://www.vmware.com/products/player/ (free VMware player)

http://www.vmware.com/products/fusion/ (WMWare for mac and it links to 30-day trial - we are hoping to get/setup a 12 months license for our are waiting for an approval for this - it looks like a possibility right now - please email me if you are interested in this).

If you find other resources please post links on the mailing list for the class.

Background:


The MINIX operating system comes with a complete set of tools, including C compiler and linker as well as debugger. If you want the less wordy description skip to the bottom of this page and just do each bullet point.

Install VMware:

Before you install MINIX you need to install a platform where MINIX runs. Minix runs (and have been tested) on both actual hardware and machine emulators (or virtual machines as we called them in class). Maintaining a uniform machine for a large class is close to impossible we will use an emulator for the class.

Hardware emulators that I have tried (that also runs on a mac) include Bochs, QEMU (Q for mac), Virtual Box, VMware, Virtual Box and Parallels. We recommend (require) VMware for this project for the following reasons - we had the least problem with VMware, it has a nice interface, it performs well, and it has a large user base, including MINIX developers (and MINIX users).

For the obsessed shopper of emulators - here is a nice comparison chart from Wikipedia and here is a recent article from December 2008 comparing Parallels with VMware on a mac platform.

The free versions of VMware are fine for now 'VMware Players' for windows users and a limited 30-day trial, 'VMWare Fusion' for mac users (I feel singled having a mac now). After the 30 day period passes for us mac users we are hoping to obtain 12 months licenses for you soon - and it looks promising as they have indicated that we have been approved.

Install Minix:

After you installed your 'platform', you need to download and Install MINIX. Minix is distributed as a [compressed] CD image file (.iso file) - which are easily installed on VMware. An 'image file' is simple an archive of an optical disk, a signle file containg lots of smaller files.

It is '.iso' because the archive file format is a standard defined by the International Organization of Standards. ISO actually have a double meaning: the acronym (ISO) and isos which in Greek means equal - It was a deliberate double meanin and itsignifies the aim of the organization which is to equalize and standardize across different cultures.

You may have heard of other ISO standards from the organization, for example the ISO standard for speed of photographic film (ISO 5800), but in addition to file ISO and CD image file ISO, there are 17,500 other standards including the grading standard of Saffron (the world's most expensive spice) and the size of paper (A4 - european paper size). The CD image file is ISO 9660.

Back to business (there may be some variations if you use windows - e.g., a button may be in a slightly different location (bottom vs. top).

Shutdown Minix:

Install Software

type packman and select additonal software, if you select all and have the same laptop that I have it will take 3 hours. Note you cannot select "update from internet", you have not set up networking (yet).

Use ftp to easily transfer files to/from Minix and your host OS:

MINIX Familiarization

Once the network is active, you might want to install a few other applications to make your life easier (unless, of-course, you used the install all option above). For example, you might want an editor (such as vim), openssh (to exchange files between Minix and the outside world using scp), a new shell (such as bash), or a version control system (such as svn). Also, check out the source code of Minix that is located in /usr/src and get a feeling for which parts of the OS are located under which directories.

Once you have played around a little bit and have become more familiar with Minix, answer the following questions (you may use the Minix Wiki to answer these)

  1. What is the name of the application (utility) that you used to install new software in Minix?
  2. What is the command that you need to issue to rebuild the kernel and install it?
  3. What is the kernel source file that holds the Minix banner string (i.e., "MINIX 3.1.4. ...") that is shown when Minix boots up?
  4. What is the name of the Minix system call with the number 33 (decimal), and how did you determine this information?
  5. The answers to these questions have to be written in a plain ASCII file called discussion.txt, which you will need to submit as part of this project (see below for instructions).
  6.  


Kernel Hack and Adding your Shell, YOSH to MINIX

At this point, it is time to rebuild the kernel. Go to:

/usr/src/tools and invoke make.

Check the options to see how a kernel can be rebuilt and installed. Make sure you select the third option "Start custom kernel" in the start screen so you run your new and freshly built and improved kernel.

When you are able to build a new kernel, it is finally time to make a small OS modification (and enter the realm of kernel hacking). First, however, you have to make a clean copy of the kernel source tree.

This is necessary for two reasons. First, when you later make changes that do not work and you want to have a reference that you can look at, the source is already there. Second, and more importantly, you need such a clean reference to create patches (see below).

So, just issue a cp -r /usr/src /usr/src.clean, and you are good to continue. Of course, you can additionally store (backup) your modified and clean source trees on a remote machine (using rsync or scp, for example) or using version control system.

For the kernel modification itself, you need to print out the name of every file that is being executed by the OS.

You should locate the kernel source file that implements the exec system call. Then, at the right point, you should insert a printf statement that outputs the string "executing ... " followed by the name of the file that is being executed. That is, when you type "ls" in the shell, you should see the string "executing ... " being printed to the console. More precisly, if a process executes /bin/ls, your code should print to the console "executing /bin/ls".

This should actually require only a single line to be added, but it provides you with some (very basic) debugging facilities. Once you have done your modification, rebuilt the kernel, install it, and reboot the system. When you were successful, you should now see a series of output statements that show you which programs the operating systems launches.

Your last task is to submit your changes to us. When dealing with large software systems (e.g., operating systems such as Linux), it does not make sense to send around the complete source code tree for every small change. For this, people invented patches. A patch captures the changes between two different files (oldfile and newfile). Given the oldfile and the patch, one can use the patch program to create the newfile. This is exactly what we want. So, when you have finished your kernel modification (including recompiling, installing, and testing everything), you switch to the /usr directory and produce a patch for each file that you have changed. For this, you invoke diff -c (path/to/oldfile) (path/to/newfile) and store the output in a file named mypatch. For example, when making a patch of the file /usr/src/servers/inet/clock.c, you would first change into the /usr directory and then do diff -c src.clean/servers/inet/clock.c src/servers/inet/clock.c. You can test whether your patch has worked by creating another copy of the source tree (e.g., /usr/test), change to /usr/test and run patch -p1 < mypatch. This should modify the clock.c file in the /usr/test tree accordingly. Also, note that this is how we test your patches, and we expect that they can be applied cleanly (without any warnings or errors).

Submitting:

Submitting:

  1. Create a file named discussion.txt with the answers to the questions listed above.
  2. Create a file named mypatch that contains the patch to the Minix kernel to print the requested debug information (as described above). Please note that this patch must cleanly apply to a fresh source tree.
  3. Your files must be in a directory named project2.
  4. Put all the materials needed discussed above in the above directory (including your README.txt file)
  5. Submit via the 'submit' command (while on atlas.cs.uga.edu)

    {atlas:maria} submit project2 csx730

Optional:

Install your shell that you created in project in the proper place and test it out and debug if needed.