For this quarter, you'll be working on your projects in CSE 006. In these labs, the WinXP machines that have been configured with the software necessary for this course (VMware ). These are Dell Optiplex P4 machines There are also two dedicated linux workstations for this course: spinlock.cs.washington.edu and coredump.cs.washington.edu.
Each of you should already have an account created on the two machines.
Roughly speaking, each project will involve the following phases:
As 451 students, you have priority access to the lab machines with VMware installed. However, if you look at the three phases above, you'll realize that you only need to use these machines during the third phase. I expect that you'll spend most of your time on phase 1 and phase 2. Please do not exercise your priority to get onto these machines if you're just working on phase 1 or 2; save that power for phase 3, otherwise you'll needlessly cause friction with other classes' students in these labs.
- Read through the Linux source code: before you can modify the code to satisfy the project, you need to understand the code that you will modify. You will use your account on spinlock or coredump for this purpose: each of you will make a private copy of the kernel source tree in specially created directories on these machines (described below); you can then safely navigate through the source tree without fear that somebody else has changed it.
- Edit the Linux source code, and compile a new kernel: once you think you know what to do in order to do a project assignment, you need make your changes to the Linux source code (either by editing existing files, or by creating new files, or both). You will then compile a new kernel. Again, you will use spinlock or coredump for this; each of you will edit your private copy of the kernel source tree, and then compile the new kernel (using spinlock or coredump) from your modified private source tree.
- Test/benchmark your new kernel: once you've successfully compiled a new kernel image, you will then need to try it out. This quarter, instead of having dedicated physical machines for experimental kernels, we've installed VMware on the WinXP machines in CSE 006. VMware is a virtual machine monitor: it is a software layer that perfectly emulates the x86 architecture, thereby allowing you to install and use any x86-based operating system on top of it. In other words, you can launch the VMware program on these WinXP machines, and then boot into Linux from inside VMware. So, once you've compiled a kernel image (which is simply an executable file), you will transfer the kernel image to one of these WinXP machines, and from there, using a process we describe below, you'll copy the image into VMware and boot into your new kernel.
To remotely log into spinlock or coredump, you need to use ssh. On the lab WinXP machines, you can find ssh as:Start->All Programs->Internet and Remote Connections->SSH->Secure Shell ClientIf you start an Xwindows server before you run ssh, then you'll be able to run Xwindows clients on spinlock or coredump. (For example, you'll be able to launch the X emacs client, or netscape.) To start an Xwindows server, run:Start->All Programs->Internet and Remote Connections->Reflection->Reflection XYour home directory on these machines is your usual /homes/iws/ directory, and it is backed up. However, due to the usual disk space quotas, you will not have enough quota in your home directory to copy or compile a kernel. Instead, we have provided each of you with local disk space. Your local disk space is in /cse451/username, where username is your unix account name. So, when you make your copy of the linux kernel, and when you edit or compile it, you should do so in this local directory, not your home account.
However, these local directories are not backed up. This means that if the disk crashes on either of these machines, all of the files in your local directory will be blown away. Thus, I strongly recommend that you keep copies of critical files in your home account; in particular, I'd keep a copy of every file that you've edited or created, and copies of the kernel images that you create. (Don't copy the entire kernel source tree, though: only copy changed files .)
One more detail: your local directory on spinlock or coredump can be accessed from the WinXP machines using Samba. To do this, simply bring up an IE window, and type an URL like:\\ntdfs\cs\unix\projects\instr\cse451s\johnnyOr:\\ntdfs\cs\unix\projects\instr\cse451c\johnnyReplacing "Johnny" with your Unix user name. If you are in section AA, your home directory resides on spinlock and you should use the first link. For AB, use the second link. This is how you will copy a kernel image from your local directory on the Linux servers to the particular WinXP machine that you're using, when you're ready to install the kernel image in VMware/linux.
To launch VMware, simply run:Start->All Programs->VMware->VMware Workstation
If a dialog box pops up, select "Open Existing Virtual Machine". If Linux is on the list, double click it, otherwise hit OK to browse, and then select c:\Program Files\VMWare\vms\linux\Linux.vmx.
If no dialog box pops up, click on "Open Existing Virtual Machine" in the VMWare window. Browse to and select c:\Program Files\VMWare\vms\linux\Linux.vmx.
By selecting this, VMware will boot into a version of Linux that has been carefully prepared for use with the 451 course. In particular, this configuration has the following properties:
We have one very strictly enforced rule for VMware usage: don't mess with the VMware configuration itself. If you do, we'll be extremely upset with you, since you might inadvertantly cause trouble for other people.
- The hard drive has been set to be non-persistent; if you power down the virtual machine, and power it back on (or if you quit and restart VMware), then any changes you made to the file system inside VMware/linux will be lost. This is a good thing: it means every time you boot VMware/linux, it will boot into a well-known, sane configuration, with a working kernel. However, this means that when you install your new kernel, you can't power down the virtual machine; instead, you'll software reboot it from inside linux (as described below).
- VMware/linux has been configured for host-only networking; this means that VMware/linux can only communicate with the WinXP host that is running it, rather than the Internet at large. Similarly, the only way to get files into VMware/linux is to ftp them from the WinXP host on which you're running VMware/linux. This was done for security reasons.
- There is only one user account: user name root, and password rootpassword. Note that I am fearlessly advertising this account name and password on a world readable web site. The reason I'm not afraid to do this is because of properties 1 and 2 above. Because of 2, only people actually sitting at the WinXP machine can log into VMware/linux (and, in fact, only people enrolled in this course can run VMware), and because of 1, nothing you do can mess it up for other people.
Once VMware starts up, and after you've selected Linux in the initial dialog box, then press the Power On button to boot Linux inside VMware. VMWare may prompt you with an error message regarding a CPUID bit. This message can be safely ignored. You will then see the boot sequence as Linux loads itself, initializes devices, etc., and once this has finished, you'll be asked to log in. Do so as username root, and password rootpassword .
To copy files into VMware/linux, you need to use ftp from the WinXP host running VMware. So, bring up your favorite FTP client, and connect to the host 192.168.93.2. 192.168.93.2 is the IP address of the Linux system running inside VMware (this IP address is the same irrespective of which WinXP machine you're using, thanks to the magic of host-only networking).
This document provides you with step-by-step instructions for building and testing a kernel. For further information on building kernels, refer to the Linux Kernel HOWTO. The VMware web site (http://www.vmware.com/) has further information on VMware.
Log onto spinlock or coredump. You should all have accounts on the machines now. SSH is available asStart->All Programs->Internet and Remote Connections->SSH->Secure Shell Clienton the WinXP machines.
Change directory to /cse451/username. You will be using this directory for your kernel development. Copy /cse451/projects/linux-2.4.20.tar.bz2 into this directory. This archive contains the kernel source code. Open it with the command "tar xvjf linux-2.4.20.tar.bz2 ".
Change directory to the linux-2.4.20. Compile the kernel with "make dep", then "make bzImage". (Don't forget to read the Kernel HOWTO). (Note that it is not necessary to run "make configure " or similar options). Compiling will take a long time (i.e. 10 minutes or so) the first time you do it, but you won't be recompiling every file all the time, so it will go much faster later on.
Assuming compilation is successful, your new kernel image will created, and named ./arch/i386/boot/bzImage.
Copy the new kernel image from arch/i386/boot/bzImage to the WinXP machine you will be using for testing. Make sure it is one of the machines that has VMware installed.
To do this, open Internet Explorer and go to the URL, \\ntdfs\cs\unix\projects\instr\yourhost\username (where "username" is your login, and yourhost is either cse451s or cse451c).
Launch VMware with Start->All Programs->VMware->VMware Workstation .
Select "Open Existing Virtual Machine". If Linux is on the list, double click it, otherwise browse to and select c:\Program Files\VMWare\vms\linux\Linux.vmx .
Power on the virtual machine.
Login as "root", password "rootpassword ". (To get the mouse back out of VMware, you need to hit Ctrl-Alt-Escape.)
From Windows, ftp the kernel image to 192.168.93.2. This is the IP address of the Linux system running on the virtual machine, irrespective of which WinXP machine you are using. To do this, open Internet Explorer and go to the URL, ftp://root:firstname.lastname@example.org and then copy your kernel image into this directory.
You could also start the ftp transfer under Linux on VMware, but then you'd have to figure out the IP address of the WinXP box. For security reasons, networking under VMware is limited to the host (WinXP) machine.
The kernel image you just ftp'd should be under /root/ on VMware/Linux. Copy it to /boot/bzImage-test.
The Linux boot loader is called lilo. At boot time, lilo selects an operating system image to run. You need to instruct lilo to select your image in order to test it.
Edit /etc/lilo.conf to append the lines in this . You might want to type this up in vi or emacs rather than copying, because of newline/linefeed problems. Note that the leading space in the second and subsequent lines are tabs.
Next, from Linux, run /sbin/lilo ; this will install your new kernel, and tweak the boot sector of the disk to load into it.
Finally, reboot the virtual machine by issuing the command shutdown -r now (from the shell). When the machine reboots, you will see a LILO boot: prompt; once you see this, hit Tab to bring up a boot: prompt, then type test in order to boot into your new kernel image. (Note that you need to click on contents of the vmware window with the mouse in order to have keyboard input fed to vmware/linux.)