This semester, you will make changes to the the linux kernel. To do that, you must be familiar with compiling the kernel, creating updates reflecting your changes, and submitting them for grading. You will repeat these operations many times for every subsequent project this semester. Project 0 is a very simple project designed to familiarize you with various pieces of linux and to instruct you in these procedures.
Project 0 consists of three parts with the following objectives:
Students are expected to use virtualization to complete their projects. Virtualization allows us to run a virtual machine ("the guest") on a real physical machine ("the host"). For the purposes of the class projects, we assume that the host machine is a PC or Mac running a version of VMWare compatible with VMWare Player. For details on H/W and S/W requirements refer to the VMware home page.
There are many linux distributions and kernel releases. This course expects students to use the Ubuntu 8.04.2 i386 and linux kernel revision 2.6.28.2.
Hard DrivesYou should buy 1 or more external USB drives to work in the lab and for backups. The drive should have at least 10GB of disk space. Flash drives or USB-powered hard disks are the most convenient option. Make sure it is USB 2.0. The cheapest option is to buy a hard drive enclosure and put a hard drive in it.
MAKE REGULAR BACKUPS. Every semester a small percentage of students experience drive failure. You will not receive an extension if your hard drive fails or the data on it becomes corrupt. At a minimum, Every time you finish making changes for the day you should backup to your computer or another disk drive.
N.B. Format your drive NTFS or ext2. FAT32 has a file size limitation that you may encounter.
N.B. The files you need and their signatures will be placed on blackboard under "Downloads" for your convenience.
Also, at the time of this writing there is no free version of VMware for Mac users. You can install windows, use the lab, or use another virtualization solution (VirtualBox, Parallels, etc). Be aware that using another virtualization software package should be fine for changing the kernel, but it will have an effect on what you turn in for this project and it is not supported by the TAs. Always test your projects in the lab before submission.
You should access these instructions from inside your VM. The next objective is to get comfortable building and installing a custom linux kernel.
sudo sh ... (commands to execute as root) exit --OR-- sudo -s ... (commands to execute as root) exit --OR-- sudo (commands to execute as root)
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential bin86 kernel-package libqt3-headers libqt3-mt-dev
cd /usr/src/ sudo chmod 775 . sudo adduser `whoami` src sudo wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.2.tar.bz2 md5sum linux-2.6.28.2.tar.bz2
tar -xjvf linux-2.6.28.2.tar.bz2 cp -ra linux-2.6.28.2 pristine-linux cp -ra linux-2.6.28.2 project0
ln -s project0 linux
cd /usr/src/linux make V=1 mrproper cp /boot/config-<some revision #>-generic /usr/src/linux/.config make V=1 xconfig make V=1 bzImage make V=1 modules ...The linux directory in the Kernel Rebuild Guide corresponds to the experimental kernel build directory.
cd /usr/src/linux sudo make V=1 modules_install
sudo update-initramfs -c -k 2.6.28.2-GLUSERNAME-FIRSTNAME-cs421project0
sudo -s cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-2.6.28.2-GLUSERNAME-FIRSTNAME-cs421project0 cp /usr/src/linux/System.map /boot/System.map-2.6.28.2-GLUSERNAME-FIRSTNAME-cs421project0 ln -s /boot/System.map-2.6.28.2-GLUSERNAME-FIRSTNAME-cs421project0 /boot/System.map
title Project 0 421 Kernel (2.6.28.2) root (hd0,0) kernel /boot/bzImage-2.6.28.2-GLUSERNAME-FIRSTNAME-cs421project0 root=UUID=(copy from another entry) ro quiet splash initrd /boot/initrd.img-2.6.28.2-GLUSERNAME-FIRSTNAME-cs421project0 quiet
cd /usr/src/ mkdir project0-submission cd project0-submission script uname -a exit cat typescript
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 always submit a "patchfile" for every Kernel project and we will apply your patch to our copy of the pristine kernel sources when grading your project. A bad patch may result in 0 points!
A good tutorial on how to create patchfiles using diff can be found at http://www.gnu.org/software/diffutils/diffutils.html. The typical call is "diff [<options>] <from-file> <to-file>"
You should have already created the pristine kernel sources directory $pristine as described earlier. You should have already built your first custom kernel as specified in Part 1, by making appropriate changes to the $prj.
cd /usr/src/ wget/project0/ignorelist.txt
cd /usr/src/ diff -rcP -X ignorelist.txt pristine-linux linux > project0-submission/patchprj0.diffThe file patchfile patchprj0.diff contains all the information the patch command needs to transform the pristine kernel sources to your experimental kernel sources.
IMPORTANT: If the ignorelist does not work then you should execute "make mrproper" in $prj directory before creating the patchfile. If you forget to do this, you may get a very large patchfile.
rm -rf verify-linux cp -ra pristine-linux verify-linux cd verify-linux patch -p1 < ../project0-submission/patchprj0.diff cd .. diff -r -X ignorelist.txt linux verify-linuxThe sources in the verify-linux directory should now be transformed into your experimental sources. The diff command above should not show any differences. For project0, if you see several "Only in project0/...", this is also OK.
Your project report and readme are due for each project you submit. If you do not submit a project report and a readme, your project will not be graded.
Your README file is located in the base directory of your submission archive and is named "README". It is a text file that explains how to compile and run your project, and gives a brief explanation of problems.
The basic Readme report should follow the following format:
Firstname Lastname glusername Date Project Keycode ==Manifest== There are X applications included with the project: Part 1: part1/ part1/file1.c part2/file2.sh ... Part 2: part2/ part2/somefile.txt ... ==Compiling== Part 1: simply run "make" Part 2: Is a kernel module, you can make it by doing XYZ, here's a stepped list: ... ==Running== Part 1: Requires 3 options, which must each be within the following range... ... ==Bugs== Part 1: -Should accept a range of 0-10, but it's actually 0-9. -Always segfaults at the end, don't know why. Part 2: ...
You may, alternatively, place a README with a manifest in the base directory and give each part it's own readme file following the above format. You are also welcome to format your README differently provided you still provide the required information.
The Project Report is a brief document named "report.pdf" in the base directory of your submission archive. It explains your rationale and approach to the project and must answer all project questions. Reports should be formatted as follows:
We expect your reports to be brief and to the point. They should not be filled with prose. Use lists, diagrams, and written pictures where possible. The report file is used to determine how much partial credit you will receive for an unworking portion of your project. The best strategy is to keep a notebook or write an outline for the report when you get started, and to update it as you go through the project.
The report file must be a PDF. You can create PDFs in a myriad of ways, and if you need to, feel free to ask on the blackboard discussion board.
Any of the following will cause significant point loss. Any item below with a "*" will give that submission a 0.
cd /usr/src/ mkdir project0-submission cd project0-submission ... copy files to appropriate locations ... cd /usr/src/project0-submission tar -cjvf project0.tar.bz2 * scp project0.tar.bz2 yourusername@gl.umbc.edu:~ ...Using Submit
Read the Submit FAQ:
submit cs421 PRJ0 <files> submitls cs421 PRJ0