CS422/522: Operating Systems, Spring 2011 — Tools

Home  –  Overview  –  Schedule  –  Reference  –  Reading List  –  Tools  –  PIOS  –  Prior Years

If you use the Linux-based Zoo machines, then all the software tools you will need for this course are already installed on the machines and ready to use. If you would like to compile and run the tools on your own machine, however, here is the information you need. We cannot guarantee that these tools will run on your computer, but they should run on recent versions of Linux.

It should be possible to get this development environment running under Windows with the help of Cygwin. Install cygwin, and be sure to install the flex and bison packages (they are under the development header).

Compiler Toolchain

Most modern Linuxes and BSDs have an ELF toolchain compatible with the CPSC 422 labs. That is, the system-standard gcc, as, ld and objdump should just work. The lab makefile should automatically detect this. However, if your machine is in this camp and the makefile fails to detect this, you can override it by adding the following line to conf/env.mk:

GCCPREFIX=
Mac OS X:

You'll first have to install gmp and mpfr. To use Mac Ports versions, do this:

# sudo port install gmp mpfr
# sudo mkdir -p /usr/local/include /usr/local/lib
# sudo ln -sf /opt/local/include/gmp* /usr/local/include/
# sudo ln -sf /opt/local/include/mpfr* /usr/local/include/
# sudo ln -sf /opt/local/lib/libgmp* /usr/local/lib/
# sudo ln -sf /opt/local/lib/libmpfr* /usr/local/lib/
You could also persuade the configure script to get gmp and mpfr directly out of the /opt/local tree, but other libraries, such as the Mac Ports version of iconv, may get mixed up with the Apple-provided version of iconv and mess up other parts of the build process. These considerations may or may not apply to Mac Fink.

If you are using something other than standard x86 Linux or BSD, you will need the GNU C compiler toolchain, configured and built as a cross-compiler for the target 'i386-elf', as well as the GNU debugger, similarly configured for i386-elf. You can download specific versions we recently verified to work via these links, although more recent versions of gcc, binutils, and GDB should work too:

Once you've unpacked these archives, run the following commands (the make install commands must be run as root):

$ cd binutils-2.20
$ ./configure --target=i386-elf --disable-nls --disable-werror
$ make
$ make install
$ cd ../gcc-4.4.2
$ ./configure --target=i386-elf --enable-languages=c --disable-nls \
	--without-headers --with-newlib --disable-threads --disable-shared \
	--disable-libmudflap --disable-libssp
$ make
$ make install
$ cd ../gdb-7.0
$ ./configure --target=i386-elf --program-prefix=i386-elf- --disable-werror
$ make
$ make install

Then you'll have in /usr/local/bin a bunch of binaries with names like i386-elf-gcc. The lab makefile should detect this toolchain and use it in preference to your machine's default toolchain. If this doesn't work, there are instructions on how to override the toolchain inside the GNUmakefile in the labs.

QEMU emulator

QEMU is a modern and fast PC emulator. Unfortunately, most versions of QEMU—in particular the default versions on the Zoo and in recent Linux distributions—contain bugs that make them usable for this class. QEMU version 0.11.1, which is known to work, is set up on zoo machines at /c/cs422/tools/bin. You can use it by adding the folder into your $PATH environment variable. Do not use the system-wide installed qemu (/usr/bin/qemu).

To build QEMU on your own box:

  1. Download and unpack the version 0.11.1 source tarball.
  2. Alternatively, if you love excitement and new versions of software, check the MIT 6.828 tools page for a version of QEMU 0.12.5 specially patched for instructional use.
  3. This version is intended for the JOS-based course at MIT, however, and your mileage may vary if you try using it in this course with PIOS.
  4. On Linux, you may need to install the SDL development libraries to get a graphical VGA window. On Debian/Ubuntu, this is the libsdl1.2-dev package.
  5. Configure the source code
    Linux: ./configure [--prefix=PFX] [--target-list="i386-softmmu"]
    OS X: ./configure --disable-sdl [--prefix=PFX] [--target-list="i386-softmmu"]
    The prefix argument specifies where to install QEMU; without it QEMU will install to /usr/local by default. The target-list argument simply slims down the architectures QEMU will build support for.
  6. Run make && make install
Mac OS X:

Due to a QEMU bug, for those who are trying to do homework or labs by ssh'ing from a Mac to a Linux box and running QEMU under X, you'll have to add an extra command-line option "-k en-us" when runnning it. For xv6, edit the Makefile; for pios, edit GNUmakefile. Search for QEMUOPTS and add "-k en-us" at the end of line. For example:

QEMUOPTS = -hdb fs.img xv6.img -smp $(CPUS) -k en-us


Copyright (c) 2000-2011 Zhong Shao and Bryan Ford, Department of Computer Science, Yale University
Many course materials derived from 6.828 by Frans Kaashoek and others at MIT.