Difference between revisions of "Compiling M5"

From gem5
Jump to: navigation, search
Line 58: Line 58:
 
</pre>
 
</pre>
  
If your output looked like the above, then congratulations, you've got M5 running! Be advised that the "scons ALPHA_SE/m5.debug" step can take a very long time, so if it looks like it's hanging, it's probably not. If you want to watch the make output go by, try adding a -v to the do-test.pl argument list.
+
If your output looked like the above, then congratulations, you've complied M5!  
 
 
At this point, you may want to go back and build some other versions of the M5 binary. There are three primary configurations:
 
 
 
 
 
* ALPHA_SE - an application-level simulator that uses syscall emulation to execute statically linked Alpha binaries compiled for either Tru64 or Linux.
 
* ALPHA_FS - a full-system simulator that models a Tsunami-based Alpha system faithfully enough to boot Linux.
 
* ALPHA_FS_TL - a full-system simulator that models a Turbolaser-based Alpha system faithfully enough to boot Compaq Tru64  Unix.
 
 
 
 
 
For each configuration, several different flavors of M5 binary can be built. The two primary flavors are:
 
 
 
* m5.debug - debugging version (g++ -g -O0 -DDEBUG)
 
* m5.opt - optimized version (g++ -O5)
 
 
 
  
 
Each configuration is built in a separate subdirectory of m5/build. For each configuration, the various flavors of binaries are built in the same directory. The default binary that you built above is ALPHA_SE/m5.debug. You can build other binaries by specifying them on the scons command line, e.g. '<code>scons ALPHA_SE/m5.opt' or 'scons ALPHA_FS/m5.debug</code>'.
 
Each configuration is built in a separate subdirectory of m5/build. For each configuration, the various flavors of binaries are built in the same directory. The default binary that you built above is ALPHA_SE/m5.debug. You can build other binaries by specifying them on the scons command line, e.g. '<code>scons ALPHA_SE/m5.opt' or 'scons ALPHA_FS/m5.debug</code>'.

Revision as of 17:35, 16 June 2006

M5 runs on Linux and OpenBSD, but should be easily portable to other Unix-like OSes. Cross-endian support has been mostly added, however this has not been extensively tested. All the syscall emulation (_SE) targets support running regardless of host/target endianess, however at present ALPHA_FS does not fully support big endian machines.

To build M5, you will need the following software:

  • g++ version 3.0 or newer. Once upon a time, M5 built with g++ 2.95, but it probably doesn't anymore.
  • Python, version 2.4 or newer.
  • SCons, version 0.96.91 or newer.
  • SWIG, version 1.3.28 or newer.

SCons is a powerful replacement for make. See here[1], to download SCons, and here for installation instructions. Note that you can install SCons in your home directory using the '--prefix=' option (see here for details) or use SCons Local if you do not have administrator privileges on the machine you are trying to compile on.

The regression tester and a few utility scripts are written in Perl, but Perl is not strictly necessary to build the simulator.

Once you have obtained and unpacked the M5 sources, the root of your of your M5 source tree should have three directories:

src 
This directory contains the sources for the simulator itself.
ext 
This directory contains external packages used by M5 that are not commonly installed on systems.
configs 
This directory contains sample script files that can be used to run M5 and as a starting place for your own configurations.
docs 
This directory has the doxygen output in it and any other interesting bits documentation we have
util 
This directory has random programs that are used in conjunction with M5 such as Python scripts to process data in an DB, submit jobs to a batch processing system, etc.
system 
This directory contains platform dependent code such as BIOS, hypervisor, that someone using M5 may want to modify.


There are multiple architectures, modes and binaries that M5 can build.

  • Architectures
    ALPHA 
    Alpha ISA
    SPARC 
    SPARC ISA
    MIPS 
    MIPS ISA
  • Types
    FS 
    A binary for full system simulation. This currently only works with the ALPHA target.
    SE 
    A binary for syscall emulation.
  • Target
    debug 
    A binary with no optimization and all debugging features (g++ -ggdb -g3 -O0 -DDEBUG)
    opt 
    A binary with optimization and all debugging features (g++ -ggdb -g3 -O5 -DDEBUG)
    fast 
    A binary with optimization and no debugging features (g++ -ggdb -g3 -O5 -DNO_DEBUG)
    prof 
    A binary with optimization that generates profile output suitable to use with gprof

Starting in the root of this tree, you can build M5 and test your build using the following commands.

% cd m5
% scons build/<arch>_<type>/m5.<target>

scons: Reading SConscript files ...
Checking for C header file fenv.h... yes
Building in /tmp/newmem/build/ALPHA_FS
Options file /tmp/newmem/build/options/ALPHA_FS not found,
  using defaults in build_opts/ALPHA_FS
Compiling in ALPHA_FS with MySQL support.
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/ALPHA_FS/base/circlebuf.do -c -pipe -fno-strict-aliasing
    -Wall -Wno-sign-compare -Werror -Wundef -g3 -gdwarf-2 -O0
    -DTHE_ISA=ALPHA_ISA -DDEBUG -Iext/dnet -I/usr/include/python2.4
    -Ibuild/libelf/include -I/usr/include/mysql -Ibuild/ALPHA_FS
    build/ALPHA_FS/base/circlebuf.cc
...

If your output looked like the above, then congratulations, you've complied M5!

Each configuration is built in a separate subdirectory of m5/build. For each configuration, the various flavors of binaries are built in the same directory. The default binary that you built above is ALPHA_SE/m5.debug. You can build other binaries by specifying them on the scons command line, e.g. 'scons ALPHA_SE/m5.opt' or 'scons ALPHA_FS/m5.debug'.