Home
Details
Lectures

Reference
Tools

Tools

This page contains the information to setup the development environment for the lecture and the lab.

Operating System

It's recommended to use Linux in this class. We cannot guarantee that these tools will run on your computer, but they should run on recent versions of Linux. You can run Linux either on the bare metal or in the virtual machine.

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). We don't recommend Windows.

Compiler Toolchain

Most modern Linuxes and BSDs have an ELF toolchain compatible with labs in this class. 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=

NOTE: The default gcc and binutils in some 64-bit x86 Linux distributions (such as Debian and Ubuntu) are not compiled with the complete 32-bit x86 support. For Debian and Ubuntu, you need to install the gcc-multilib package in addition. For other Linux distributions, you may need to install the equivalent packages.

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
  $ mkdir build
  $ cd build
  $ ../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 GNUmakefile in the labs.

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.

QEMU Emulator

QEMU is a modern and fast PC emulator. Unfortunately, most versions of QEMU contain bugs that make them unusable for this class. Instead of using the default system-wide qemu (/usr/bin/qemu), you need to build QEMU on your own box:

  1. Download and unpack the version 0.11.1 source tarball.
  2. 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 (run as root!):
          # apt-get install libsdl1.2-dev
        
  3. Configure the source code:
          $ ./configure --target-list="i386-softmmu" --disable-kvm
        
    The target-list argument simply slims down the architectures QEMU will build support for.
  4. If you are building QEMU 0.11.1, download and apply this patch:
          $ patch -p0 < qemu-ats.patch
        
  5. Run
          # make && make install