CS 502 Operating Systems WPI,
Fall 2007
Assigned: Monday, November 12, 2007 Due:
Monday, December 3, 2007
In this project, you may undertake any one of the following three challenges:–
A. Port the open source version of vmhgfs (the VMware Host-Guest File System) into the kernel source tree of your Linux kernel and edit the VMware Tools configuration script accordingly.
B. Figure out how to use KDB, the Linux Kernel Debugger, to debug the kernel, and write a set of instructions for use by other members of the class.
C. Discover whether or not Eclipse can be used as an integrated development environment for the Linux kernel, and if so, show how it can be done.
This is a discovery project. There are no “right” answers. Instead, you are to figure out how to do one of the above challenges, make as much progress as you can toward that goal, and report. The results of your project will be used in future CS-502 courses.
As you know, Linux and other modern operating systems support the concept of Virtual File System — i.e., an interface for implementing real file systems on a variety of media and connecting them to the operating system kernel at run time. This concept is described in §11.2.3 and §21.7 of Operating System Concepts (7th ed.) by Silbershatz, Galvin, and Gagne. The Linux implementation is described in great detail in Chapter 12 of Linux Kernel Development (2nd ed.) by Robert Love.
VMware provides a special file system that allows the host and guest operating system to share a folder. This is called the Host-Guest File System, or HGFS for short. A copy was installed in your Linux virtual machine as part of the VMware Tools installation prior to distribution to the class.
When the file system and shared folders are enabled, the HGFS is automatically mounted on the directory /mnt/hgfs in the guest (Linux) operating system. When you open this directory, you can see the contents of the host folders that you specify when setting up your virtual machine. You can then transfer files back and forth between the host and the guest by copying or dragging and dropping.
Last summer, CS-502 students investigated why the HGFS stops working when a new kernel was built and booted and why it did not start working again when the previous kernel was rebooted. A copy of that assignment can be found here (.doc, html). A link to student submissions for that project will be provided in class.
In summary, students on that project discovered that each of the tools in the VMware Tools package is automatically compiled under VMware Tools configuration script (a PERL script). Moreover, at system startup, VMware Tools checks the see if the version of the kernel is the same as when the tools were compiled, and if not, it disables them. The effect is that HGFS is disabled as soon has students install and boot a new kernel.
The purpose of this project is to figure out how to port the HGFS part of VMware Tools directly into the Linux kernel source tree, so that it builds automatically, every time a student recompiles the kernel. Moreover, it should load automatically, regardless of whether the other VMware Tools are properly configured for the current kernel.
Recently, VMware released open source versions of VMware Tools. These can be found here:–
http://www.vmware.com/resources/opensource/projects.html
and
http://open-vm-tools.sourceforge.net/
You should use this version for this project.
In this project, you must examine the source code for HGFS (you may ignore the rest of VMware Tools), create an appropriate subdirectory in your Linux kernel tree, figure out how to make an entry into the kernel configuration step so that the HGFS get compiled, and finally, figure out how to load it automatically.
There are a lot of steps in this project — perhaps more than are feasible in the remainder of this term. Moreover, there may be things that we still don’t know about HGFS that would prevent successful completion of this project before the end of term. Your responsibility is to learn as much as you can within the time available and to report.
If you can finish the project, please submit a patch file with the newly configured HGFS. If not, submit a brief project plan for how you or someone else should go about finishing the project at another time. In either case, you should also produce a short report summarizing what you learned.
As you have no doubt experienced, debugging the Linux kernel using only printk() statements is an experience in masochism. However, it is the approach that is most readily taught and used by students who have never tried kernel modifications before.
A few other options for debugging the kernel exist, but none of them is very straightforward. Robert Love provides an entire chapter on kernel debugging in Linux Kernel Development, 2nd ed., namely Chapter 18, and he lists several approaches. KDB, the Kernel Debugger, is one such approach.
Apparently, the patches for using kdb are already installed in the Open SUSE Linux kernel on your virtual machines. However, they do not seem to be compiled by default.
In this project, you should figure out how to set up and configure kdb (or one of the other options discussed by Love) and how to use it to debug your kernel. You should try it on one of your previous projects to show how it works. Write a set of instructions explaining other students how to use kdb in a future term of this course.
It may turn out that there is not enough information or structure to complete this project within the time available during this term. If that is the case, get as far as you can and report on what you learned. Include in your report a brief project plan about what to do next to create a good quality Linux kernel debugging facility for your virtual machines.
Eclipse is a popular, open-source, integrated development environment for many kinds of programming projects. Your virtual machine includes a recent version of Eclipse installed on the desktop, along with the Eclipse C/C++ development package.
This project is to discover whether or not Eclipse is of any use whatever during kernel development. That is, you must figure out whether the Linux kernel source tree (specifically, your copy-on-write clone of the tree) can be put under Eclipse management, and if so, what does it take.
The advantage of using a tool like Eclipse is that it helps to find files, functions, definitions, declarations, etc., and to generally reduce the nitty-gritty overhead of programming a big system. However, Eclipse and most other Integrated Development Environments (IDEs) expect a certain style in the code under management. Such an expectation may be incompatible with the Linux kernel.
For this project, you should attempt to bring the kernel tree under Eclipse and see what happens, what you can do with it, how you can build it, etc. If you are successful, write a set of instructions for students of a future term. If you find that Eclipse and the Linux kernel source tree are too incompatible with each other, figure out why and explain in your report.
If, after you have experimented, you cannot determine whether Eclipse would be a suitable development environment for the Linux kernel, explain the reasons for and against. Also, present a brief project plan about how someone else would go about figuring this out. Finally, if you discover a convincing statement for a respected authority that neither Eclipse nor any other integrated development environment can be used with the Linux kernel, this option of Project 4 is disqualified.
Please submit your project using the web-based turnin facility at
http://turnin.cs.wpi.edu:8088/servlets/turnin.ss
For purposes of turnin, this assignment is Project 4.
Students may collaborate with each other or with people outside the class on this project. However, each student must write an individual report discussing his or her findings and recommendations. If you collaborate or consult someone outside the class, you must also identify those people and explain what their qualifications are.
Your project grade will be based not so much on the progress you make or don’t make but rather on how much you learn and how you learn it and report it.