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 submitting them for grading. You will repeat these operations many many times during the semester. Project 1 is a simple project designed to get you started with these procedures. It has two objectives:
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 Workstation). We will use a standard linux distribution, the ISO images of which will be available from myUMBC (Follow links to Business Services, then Campus Software License Information, and finally UMBC RedHat Linux 3.0). You can download and burn this onto CDs. We have also provided a web page with instructions on how to obtain, compile and install the kernel.
We will only use RedHat Linux ES3 with the kernel version 2.4.21-20.EL that comes with the distribution for ALL the projects. Absolutely no exceptions!!!
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. 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.
uname -aand look at its output.
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.
IMPORTANT: Before you use the diff command, do
make cleanand
make mrproperin 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 -rcNP /usr/src/pristine-linux /usr/src/linux-2.4.21-20.EL > /tmp/patchPrj1.diff
The file
/tmp/patchPrj0.diffcontains all the information the patch command needs to transform the pristine kernel sources to your experimental kernel sources.
cp -r /usr/src/pristine-linux /tmp/verify-linuxEnter the "verify" directory, and apply the patch.
cd /tmp/verify-linux patch -p4 < /tmp/patchPrj1.diffThe 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