![]() |
CS 261 Research Topics in Operating Systems, Fall 2011ToolsYou'll use two sets of tools in this class: an x86 emulator, QEMU, for running your kernel; and a compiler toolchain, including assembler, linker, C compiler, and debugger, for compiling and testing your kernel. Here's the information you'll need to download and install your own copies. This class assumes familiarity with Unix commands throughout. Compiler ToolchainA "compiler toolchain" is the set of programs, including C and C++ compilers, assemblers, and linkers, that turn code into executable binaries. You'll need a compiler toolchain that generates code for 32-bit Intel architectures ("x86" architectures) in the ELF binary format. We recommend you configure one of your machines (such as a laptop) with a working toolchain, but if you cannot do this, a class compute server could be made available shortly. Test Your Compiler ToolchainModern Linux and BSD UNIX distributions already provide a toolchain suitable for CS 261 Research Topics in test your distribution, try the following commands:
% objdump -i
The second line should say elf32-i386.
% c++ -m32 -print-libgcc-file-name
The command should print something like /usr/lib/gcc/i486-linux-gnu/version/libgcc.a or /usr/lib/gcc/x86_64-linux-gnu/version/32/libgcc.a. If both these commands succeed, you're all set, and don't need to compile your own toolchain. If the c++ command fails, you may need to install a development environment. On Ubuntu Linux, try this:
% sudo apt-get install build-essential
On 64-bit machines, you may need to install a 32-bit support library. The symptom is that linking fails with error messages like "__udivdi3 not found" and "__muldi3 not found". On Ubuntu Linux, try this to fix the problem:
% sudo apt-get install gcc-multilib
Using a Virtual MachineOtherwise, the easiest way to get a compatible toolchain is to install a modern Linux distribution on your computer. With platform virtualization, Linux can cohabitate with your normal computing environment. Installing a Linux virtual machine is a two step process. First, you download the virtualization platform.
VirtualBox is a little slower and less flexible, but free! Once the virtualization platform is installed, download a boot disk image for the Linux distribution of your choice.
This will download a file named something like ubuntu-10.04.1-desktop-i386.iso. Start up your virtualization platform and create a new (32-bit) virtual machine. Use the downloaded Ubuntu image as a boot disk; the procedure differs among VMs but is pretty simple. Type objdump -i, as above, to verify that your toolchain is now set up. You will do your work inside the VM. Building Your Own ToolchainThis will take longer to set up, but give slightly better performance than a virtual machine, and lets you work in your own familiar environment. (Mac/Unix Only) We assume that you are installing the toolchain into /usr/local. You will need a fair amount of disk space to compile the tools (around 1GiB). If you don't have that much space, delete each directory after its make install step. Download the following packages:
(You may also use newer versions of these packages.)
Unpack and build the packages. The green bold
text shows you how to install into
Troubleshooting
QEMU EmulatorWe provide a patched version of the QEMU emulator with improved support for debugging. (Credit to Kohler and Austin Clements and others at MIT 6.828.) We recommend you compile QEMU from this source; if you use the version that came installed on your Linux distribution, you will not be able to complete all the debugging exercises. First, download the source: On a Linux machine, you will need to install the SDL graphics library to build QEMU. On Ubuntu or Debian:
sudo aptitude install libsdl1.2-dev
Then unpack, compile, and install QEMU as follows. tar xjf qemu-0.15.0-jos.tar.bz2 cd qemu-0.15.0-jos To configure on Mac OS X: ./configure --prefix=/usr/local --disable-sdl --enable-cocoa \ --disable-docs --target-list="i386-softmmu x86_64-softmmu" The QEMU monitor is accessible by pressing Ctrl-Alt-2 inside the QEMU window. Return to normal display with Ctrl-Alt-1. QEMU tends to take control of your mouse. If you can't find a mouse pointer, check the QEMU title bar for text like "Press Ctrl-Alt to exit grab" and, if so, press Ctrl-Alt to regain control. Source Code ControlYou will do your work using a version control system. This will help you maintain two parallel branches—one with your changes, and one with the labs as we release them. We will support the Git distributed version control system, which may be familiar to you from other classes or Github. You don't need to compile CVS or Git yourself. The packaged version that comes with your OS will be good enough. You just need to install it.
Using Cygwin on a Windows MachineIf you have a Windows machine, but cannot run a Linux virtual machine or install a dual-boot configuration, the easiest way to work on labs from home will be to use a class compute server coupled with VNC remote display. Let us know as soon as possible if you want this configuration to work. Nevertheless, it should be possible to execute many of
the above steps and get a functional build environment running on
Windows using Cygwin. Here's how to
install Cygwin on your Windows machine.
You should also be able to compile the class tools and the labs on your Windows machine, once Cygwin has been installed. Let us know if you have success with this. |