You are on page 1of 3

Running Gem5 on Ubuntu in Full System Mode

Qi Guo <guoqi@ict.ac.cn> Institute of Computing Technology, Chinese Academy of Sciences M5 was updated as Gem5. This tutorial introduces how to running Gem5 in full system mode on X86 Ubuntu system.

Section 1. Compiling Gem5 for Full System Simulation


1. Obtaining necessary files from Gem5 website a) tip.tar.bz2: containing the source files of gem5 b) M5_system_2.0b3.tar.bz2: including linux 2.6.13 kernel Copy these files under the directory as $GEM5 2. Required software, you can also refer to the website in Compiling M5 section a) G++: 3.4.6+ b) Python: 2.4+, it may need to install python-dev c) Scons: 0.98.1+, you can update it with apt-get (2.0.1) d) SWIG: 1.3.31+, you can update it with apt-get (1.3.40) e) Zlib f) m4 3. Compiling M5 % cd $GEM5 % tar jxvf tip.tar.bz2 % cd gme5-stable-XXX Building the Gem5 Binary by scons, our target ISA is ALPHA % scons build/ALPHA_FS/gem5.opt 4. Installing Full System files a) copy M5_system_2.0b6.tar.bz2 into $GEM5 b) tar jvxf M5_system_2.0b3.tar.bz2 c) mkdir $GEM5/dist d) mv M5_system_2.0b3/* $GEM5/dist/ e) Modify the config file $GEM5/config/common/SysPath.py except KeyError: path = [ '/dist/m5/system', '/home/guoqi/simulators/gem5/dist/m5/system' ] into except KeyError: path = [ '/dist/m5/system', '$GEM5/dist' ] 5. Running Gem5 % $GEM5/build/ALPAH_FS/gem5.opt $GEM5/config/example/fs.py You can refer to $GEM5/m5out/system.terminal to monitor the process booting the linux kernel. 6. Using M5Term to interact with simulated system % cd $GEM5/util/term % make

% make install % m5term localhost 3456 Now you can successfully communicate with the simulated system on Ubuntu 10 running on the VMWARE workstation, and the simulation speed is not bad : ) 7. Using scripts to running commands on simulated system a) You can refer to $GEM5/config/boot/*.rcS to write your own running scripts b) ./build/ALPHA_FS/gem5.opt ./configs/example/fs.py --script=configs/boot/runscript.rcS

8. Integrate with McPAT a) Obtaining McPAT from website as http://www.hpl.hp.com/research/mcpat/ b) Obtaining patch from Richard Strongs website (UCSD) as https://bitbucket.org/rickshin/m5-mcpat-parser c) Patching d)

Section 2. Running SPLASH-2 in full-system mode


The official website of Gem5 only provides the compiled binaries of SPLASH-2 programs for SE mode. In order to run SPLASH-2 in FS mode, we should use the cross-compile tool to attain alpha binaries of the SPLASH-2 programs. 1. Obtaining cross-compile tools The Gem5 website provides several prebuilt cross-compilers for convenience. Here we recommend using the following version of cross-compiler: Gcc-4.3.2, glibc-2.6.1 (NPTL, x86/32) The corresponding file is alphaev67-unknown-linux-gnu-x86-32.tar.gz 2. Obtaining original SPLASH-2 from http://www-flash.stanford.edu/apps/SPLASH/

3. Patching it following instructions provided from http://www.capsl.udel.edu/splash/ 4. Modifying $SPLASH/codes/Makefile.config Replacing original gcc with cross compiler
CC := $CROSSCOMPILER/alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-cc

$CROSSCOMPILER is the base directory where that cross compiler places. 5. Compiling each program Most programs can be compiled directly via make command under corresponding directory. Id like to introduce this process of some nontrivial programs, e.g., VOLREND: Compiling VOLREND a. Enter subdiretory ./libtiff to obtain libtiff.a for building executable VOLREND, modifying ./libtiff/Makefile as:
29 -AR= 29 +AR= /usr/bin/ar $CROSSCOMPILER/alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-ar

32 -CC=gcc 32 +CC= $ CROSSCOMPILER /alphaev67-unknown-linux-gnu/bin/alphaev67-unknown-linux-gnu-cc

150 150 +

${CC} -o mkg3states ${CFLAGS} mkg3states.c gcc -o mkg3states ${CFLAGS} mkg3states.c

b. Archive file libtiff.a could be obtained by make c. Executable file VOLREND could be obtain by make in top level directory. 6. Updating current disk image I will elaborate how to insert SPLASH-2 binaries into PARSEC-2.1 disk image provided by http://www.cs.utexas.edu/~parsec_m5, You can refer to their manual for the following steps and writing you own running scripts for SPLASH-2 and PARSEC-2.1. a. Mounting obtained linux image with PARSEC test % sudo mount o loop, offset=32256 /path/to/image/file /mount/point b. Transferring file to this disk % sudo cp /path/to/splash2 /mount/point/splash2 c. Unmounting this disk % sudo umount /mount/point

You might also like