CMSC421
Principles of Operating Systems
 

Project 0.

10 points. [Keycode: PRJ0].

Due by 11:59pm on September 26, 2005.

You will be making changes to the linux kernel for your projects this semester. So you must get familiar with compiling the kernel, creating updates reflecting your changes and then submiting them for grading. You will repeat these operations many many times during the semester. Project 0 is a simple project designed to get you started with these procedures. It is a simple two part project with two objectives:

Part 1: Installing Linux and building a custom kernel

The first objective is to get comfortable building a custom linux kernel and installing it (on a USB external drive in the Lab or on your own computer, or partition on your own computer, or using VMware 4/5 Workstation).

We will only use RedHat Enterprise Linux 3.0 with the kernel version linux-2.4.21-20.EL that comes with the distribution for ALL the projects. Absolutely no exceptions!!!

Download the two ISO files (umbc-rhel-3.01-disc1.iso, and umbc-rhel-3.01-disc2.iso) from myUMBC (under the Busines Services tab) to your local system. Burn CD-R's in ISO format from the CD Image files (ISO) you downloaded (if you don't, you will not be able to boot from the CDs). Most will find this easier from Windows.

Read the installation guide for detailed installation instructions. Make sure that you install the kernel sources and the kernel development tools from the distribution when you install the system. (This should be done automatically for you.)

We will refer to original "untainted" kernel source directory that comes with the distribution as the pristine kernel sources. Before you do anything else, make a complete copy of the pristine kernel sources in the directory /usr/src/pristine-linux using the command

cp -r /usr/src/linux-2.4.21-20.EL /usr/src/pristine-linux
We will refer to this as the pristine kernel sources directory. Never make any changes in this directory.

Next step is to compile and install your first custom kernel. Read Appendix A. Building a Custom Kernel very carefully before you proceed. (This was from the Redhat Linux 8.0, but should still be valid.)

Part 2: Creating kernel updates

The second objective is to learn using diff to generate kernel source patches (updates) and applying the patches to the original kernel. Since many modifications to the kernel are small (compared to the total kernel source size), such updates are usually distributed as "patches". If you make minor modifications to the kernel (e.g. for CMSC421 projects) you will want to create a patch. Remember that you will be always be submitting the "patchfiles" for every project and we will apply your patch to our copy of original sources when grading your project. A bad patch may result in 0 points!

You should have already created the pristine kernel sources directory /usr/src/pristine-linux as described earlier. You should have already built your first custom kernel as specified in Part 1, by making appropriate changes to the kernel sources in the directory /usr/src/linux-2.4.21-20.EL. We will refer to the sources in the directory /usr/src/linux-2.4.21-20.EL as the experimental kernel sources.

How to create a patch

Use the "diff" command to generate the "patchfile" for your custom kernel. A good tutorial on how to do this can be found at http://www.gnu.org/software/diffutils/manual/diff.html. Below are step-by-step instructions for creating the patch file using the Unix command "diff".

IMPORTANT: Before you use the diff command, do

 make clean 
and
 make mrproper 
in both the pristine and the experimental kernel source directories to remove all the executables and object files. If you forget to do this, you will get a very large patchfile.
diff [< options >] < from-file > < to-file> >

In your Unix shell use the command:

diff -rcP /usr/src/pristine-linux /usr/src/linux-2.4.21-20.EL > /tmp/patchPrj0.diff

The file

/tmp/patchPrj0.diff
contains all the information the patch command needs to transform the pristine kernel sources to your experimental kernel sources.

How to verify/validate your patch

You should always validate your patchfiles before submitting them. To validate whether your patch works or not, you can use the "patch" command. Make a full copy of your pristine kernel sources to the directory /tmp/verify-linux using the command
cp -r /usr/src/pristine-linux /tmp/verify-linux
Enter the "verify" directory, and apply the patch.
cd /tmp/verify-linux
patch < /tmp/patchPrj0.diff
The sources in the /tmp/verify-linux directory should now be transformed into your experimental sources. You can use the "diff" command to insure that there are no differences between these two directories, that is the following command should not show any differences
diff -r /tmp/verify-linux /usr/src/linux-2.4.21-20.EL

What to submit

You will submit a single tar-gzipped file "project0.tar.gz" that contains: your patchfile patchPrj0.diff for your first custom kernel, and sample output from the "uname -a" command run in your system booted with your custom kernel.

Hints