Tools Used in Operation System Course

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 OS labs. That is, the system-standard gcc, as, ld and objdump should just work. If you are running Ubuntu/Debian Linux, you can get the toolchain using the command:

% sudo aptitude install build-essential

If you are NOT using standard x86/x86-64 linux or BSD, you will need the GNU C compiler toolchain, configured and built as a cross-compiler for the target 'i386-jos-elf'. You can download the specific versions we used via these links, although more recent versions of gcc and binutils should work too:

Once you've unpacked these archives, run the following commands as root:

% cd binutils-2.15
% ./configure --target=i386-jos-elf
% make
% make install
% cd ../gcc-3.4.1
% ./configure --target=i386-jos-elf
% make
% make install

If there are errors compiling gcc when it gets to libstdc++, don't worry about it.

Then you'll have in /usr/local/bin a bunch of binaries with names like i386-jos-elf-gcc. It will also be necessary to change the GNUMakefile used in the labs to use i386-jos-elf-gcc instead of gcc. There are instructions for how to do this inside of GNUMakefile.

1 QEMU Emulator

We will use a patched QEMU 0.10.6/0.15 in this lab. Nelson Elhage has written up directions for using QEMU with our course. To build the patched QEMU:

  1. Download and unpack the pre-patched 0.10.6/0.15 source tarball.
    cd ~
    
    	  # for QEMU 0.15 in Lab 4
    	  wget http://ipads.se.sjtu.edu.cn/courses/os/2015/tools/qemu-1.5.2.tar.bz2
    	  tar xf qemu-1.5.2.tar.bz2
    	
  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. You may also need basic building tools
    sudo aptitude install build-essential autoconf libtool
    	
  3. Configure the source code:

    Linux:

    cd qemu-1.5.2
    	  ./configure --prefix=/usr/local --target-list="i386-softmmu"
    	

    OS X:

    cd qemu-1.5.2
    	  ./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.

  4. Run make && make install
    make
    	  sudo make install
    	
For labs before lab4, You shall use QEMU-0.10.6.
Otherwise, you shall use QEMU-0.15.

Expect scripting system

'Expect' is an advanced scripting language and runtime system for user to control a running application. Our grading script (when use QEMU in our lab) is based on 'Expect'. To build 'Expect':

  1. Check whether you already have 'expect' by typing 'expect' in your shell, it will prompt an console like "expect1.1>".
    If no command 'expect' found, continue with the following step.
  2. On Debian, expect cooresponds to the 'expect' package when you use 'apt-cache' to search the package. On Fedora, you may use 'yum' to search the package. Otherwise, download 'expect' from the official website.

Virtual Machine For JOS

Debian 6.0: jos-student.rar

Install packages in Virtual Machine

You need to change the apt source if you are using this VM and want to install packages with the package manager. To do this, edit /etc/apt/sources.list with the sudo priviledge like following.
deb ftp://ftp.sjtu.edu.cn/debian/ squeeze main contrib non-free
deb ftp://ftp.sjtu.edu.cn/debian/ squeeze-updates  main
Then update the index of apt package manager
sudo apt-get update
Then you are free to install new packages. ( Note that the error information about trusted key is harmless.)

For example, you can install expect, which is needed for the grade script, with the following command
sudo apt-get install expect


Questions or comments regarding AOSI class? Send e-mail to the TAs at General Info.

Top

Acknowledges the MIT 6.828 course (Operating System Engineering)