This homework is due on Tuesday, February 10, at 11:59:59 PM (Eastern standard time). You must use the submit to turn in your homework like so: submit cs421_jtang hw1 hw1.tar.bz2
All of your homework assignments must run under 32-bit Linux, specifically Ubuntu 14.04 LTS ("Trusty Tahr"). All of the projects will require making changes to the Linux kernel. In addition, all projects will be performed inside of a Virtual Machine for various reasons (uniformity of results, for instance). In order to do the later assignments in this course, you must become familiar with running Linux on your own computer. For projects, you will be compiling the kernel inside the VM and submitting patches to the kernel source code. In this homework, you well become familiar with the procedures of installing and updating the kernel inside a VM.
This homework is divided into several parts that will help you perform the following objectives:
If you choose to work in the lab, you will need an external USB hard drive or flash drive for development as well as for backups. You will need to have at least 20GiB of free space on the drive to store your VM image on it, so a 32-GiB or larger drive is highly recommended. Also, you will need to format the drive as some type of filesystem that supports files of size > 4GiB. Many flash drives come pre-formatted as FAT32, which does not support files with a size >= 4GiB. FAT32 will not work for this reason! You should format your drive as either NTFS (if you will be using Windows with the drive as well) or a Linux filesystem such as ext3. In addition, some earlier versions of VirtualBox complain when the virtual machine image resides on an ext4 volume, so you may want to avoid ext4 when storing images.
In order to aid development of the projects in this course, we will be running the projects under virtualization. Virtualization allows us to run a Virtual Machine on an actual physical machine. In this way, we can run a second guest operating system inside the regular host operating system. To do the projects in this class, we assume you will have access to a relatively modern PC that can run the VirtualBox VM. VirtualBox requires an x86 CPU with a decent amount of RAM. In addition, it would be advantageous if the CPU on your host machine supported the x86 Virtualization extensions (VT-x for Intel processors, or AMD-V for AMD processors). For more information about hardware and software requirements for VirtualBox, please consult the VirtualBox website. All assignments are expected to run in 32-bit mode on VirtualBox.
VirtualBox is available on the machines in the ITE 240 lab under both Linux and Windows. You can also download it for free from https://www.virtualbox.org/wiki/Downloads to run under your own Windows, Mac, or even Linux host operating system.
For the purposes of assignments in this course, we will be using the x86 (32-bit) version of the Ubuntu 14.04 Linux distribution. In addition, the custom kernels that will be built in this course will be based on the Linux kernel version 3.14.8 (the latest long-term stable kernel as of this writing).
Perform the following tasks to create the environment that will be used to complete assignments in this course. These instructions are based upon a WikiHow article.
sudo apt-get update && sudo apt-get upgradeYou will need to enter your password to run the operation as root.
Many of the commands that you will be running on the Linux installation within the VM will require root privileges. There are a variety of methods to elevate your user privileges on Linux. You can use any of the following methods to do so:
sudo -s (enter your user password when prompted) (perform any commands to execute as root) exitOR
sudo sh (enter your user password when prompted) (perform any commands to execute as root) exitOR
sudo (command to execute as root)
Ubuntu ships with the 3.13 Linux kernel. For this assignment, you will upgrade to the 3.14 kernel. The next step is to obtain the kernel sources. Follow these steps to do that:
sudo apt-get install gcc g++ libqt4-dev libncurses5-dev emacs vim perl nano patch git
cd /usr/src sudo chmod 775 . sudo chown root:adm . git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linuxThis last command downloads the latest version of the Linux source code repository, via git, and places the repository into a linux directory. If you are not familiar with the git version control system, you should work through the Interactive Git Tutorial before proceeding.
cd /usr/src/linux git checkout linux-3.14.yFor the rest of this assignment, the sources in the directory /usr/src/linux will be referred to as your working copy of the kernel, or alternatively, Linux kernel repository. If you ever need the original unmodified code, re-run the clone command in a different directory; advanced git users may also make branches within the repository.
For this assignment, you will perform a simple modification of the official Linux kernel. You will personalize the version string with your UMBC GL username. If you have followed all of the instructions up to this point, you should have no trouble doing this. You will know if your change is correct by running the uname -a command. When you run uname -a using the stock Ubuntu kernel, note how version string states Ubuntu is the creator.
cd /usr/src/linux make mrproper cp /boot/config-$(uname -r) .config make xconfig make -j2 sudo make modules_install install
mkdir $HOME/hw1 uname -a > $HOME/hw1/uname.out
Your next objective is to learn about patches and diffs. Since many modifications to the kernel are small (compared to the total kernel source size), such updates are usually distributed in the form of a patch file; those patch files describe differences between the original software and the modified code. If you make minor modifications to the kernel (such as for CMSC421 projects) you will want to create patches containing the diffs. Remember that you will always submit patches for every kernel project and we will apply your patches to our copy of the kernel repository when grading your project. A bad patch file may result in 0 points!
git diff > $HOME/hw1/customized-uname.patch
Now that you have created a patch file, you will do the converse by applying a patch.
wget http://www.csee.umbc.edu/~jtang/cs421.s15/homework/hw1.patch
patch -p1 < hw1.patch
You should submit a single .tar.bz2 file hw1.tar.bz2 containing the following files:
You can create the hw1.tar.bz2 file as follows:
cd $HOME/hw1 ... copy the files requested into this directory if they are not already there ... cd $HOME tar cjvf hw1.tar.bz2 hw1
Once you create this tarball, upload it to the UMBC gl server like so:
scp hw1.tar.bz2 glusername@linux.gl.umbc.edu:Then run the submit command as described at the top of this page to submit your work and gain credit for this assignment.