预装软件
需要检查
在安装要求的预装软件之前,需要检查是否有如下软件,否则后面安装预装软件会报错:
$ sudo apt-get install build-essential
$ sudo apt-get install flex
$ sudo apt-get install bison
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install python-docutils
GemFI要求预装的软件
参考官方文字:
To build gem5, you will need the following software:
g++version 4.3 or newer.
Python, version 2.4 - 2.7 (we don’t support Python 3.X). gem5 links in the Python interpreter, so you need the Python header files and shared library (e.g., /usr/lib/libpython2.4.so) in addition to the interpreter executable. These may or may not be installed by default. For example, on Debian/Ubuntu, you need the “python-dev” package in addition to the “python” package. If you need a newer or different Python installation but can’t or don’t want to upgrade the default Python on your system, see http://www.gem5.org/Using_a_non-default_Python_installation
SCons, version 0.98.1 or newer. SCons is a powerful replacement for make. If you don’t have administrator privileges on your machine, you can use the “scons-local” package to install scons in your m5 directory, or install SCons in your home directory using the ‘–prefix=’ option.
SWIG, version 1.3.34 or newer
zlib, any recent version. For Debian/Ubuntu, you will need the “zlib-dev” or
“zlib1g-dev” package to get the zlib.h header file as well as the library
itself.
m4, the macro processor.
-
笔者使用Ubuntu 15.04 vivid i386,需要预装列表如下
- gcc v4.3 or newer
- python v2.4-2.7
- python-dev (Ubuntu user)
- scons v0.98.1 or newer
- swig v1.3.34 or newer
- m4
- zlib1g
- zlib1g-dev (Ubuntu user)
- protobuf
- protobuf-compiler
- libprotobuf-dev
- dmtcp
gcc、python
已经预装,可以使用如下命令行查看版本号:
$ gcc -v
$ python --version
apt-get安装
$ sudo passwd root
$ su
# apt-get install scons
# apt-get install swig
# apt-get install m4
# apt-get install python-dev
# apt-get install zlib1g
# apt-get install zlib1g-dev
# apt-get install protobuf-compiler
# apt-get install libprotobuf-dev
protobuf安装
# cd /file/of/protobuf
# ./configure
# make
# make check
# make install
dmtcp安装
笔者将dmtcp文件夹放在/home目录下。笔者使用dmtcp-2.4.0-rc3,点击官网链接,获得dmtcp。
# cd /file/of/dmtcp
# ./configure
# make
# make check
# make install
在安装好dmtcp后,/usr/local/include中只有dmtcp.h文件,缺少文件导致随后安装GemFI出错,笔者最后采用手动添加的方式,把dmtcp-2.4.0-rc3文件夹中include子目录下的所有头文件拷贝至/usr/local/include中。
# cp -r /home/dmtcp-2.4.0-rc3/include/* /usr/local/include
GemFI中需要添加的文件
笔者使用alpha指令集全系统仿真,参见官网原文,需要添加如下文件:
Alpha
Full System Files – Pre-compiled Linux kernels, PALcode/Console code, and a filesystem
Unchanged since M5 2.0 beta 3. If you already have these you don’t need them again.
linux-dist – Everything you need to create your own disk image and compile everything in it from scratch
下载链接:
m5_system_2.0b3.tar.bz2
linux-dist.tgz
m5_system_2.0b3
将下载的m5_system_2.0b3.tar.bz2文件解压,新建文件夹dist,将m5_system_2.0b3的两个子文件夹拷贝至dist中。
参考官网原文:
The original system files that can be downloaded from http://www.m5sim.org/Download will have the following directory structure upon extracting:
system/
——binaries/
————console
————ts_osfpal
————vmlinux
——disks/
————linux-bigswap2.img
————linux-latest.imgNow, if you are going to run for the ALPHA ISA, then you need to swap the ts_osfpal, vmlinux, linux-latest.img files in the above directory structure with the ones provided at http://www.cs.utexas.edu/~parsec_m5/
下载文件:
vmlinux_2.6.27-gcc_4.3.4 更名为vmliux并替换binaries中原vmliux
tsb_osfpal 更名为ts_osfpal并替换binaries中原ts_osfpal
linux-parsec-2-1-m5-with-test-inputs.img.bz2 解压并放入disks文件夹,删除原linux-latest.img文件。
参考官网原文:
After unzipping the file, you will need to specify where gem5 should look for the disk image. In the file ./configs/common/SysPaths.py, specify the path to your disk image in the line:
path = [ ’/dist/m5/system’, ’<complete path to your disks and binaries directory>’ ]
Next, in ./configs/common/Benchmarks.py, specify the name of your disk image. For example:
return env.get(’LINUX_IMAGE’, disk(’linux-parsec-2-1-m5.img’))
修改./configs/common/SysPaths.py第53行为:
path = [ '/dist/m5/system', '/home/gemfi-master/dist' ]
修改./configs/common/Benchmarks.py第55行为:
return env.get('LINUX_IMAGE', disk('linux-parsec-2-1-m5-with-test-inputs.img'))
linux-dist
下载linux-dist.tgz并解压,放到gemfi-master文件夹中。
$ cd /file/of/linux-dist
$ sudo ./configure
$ make
$ sudo make install
随后将gemfi-master文件夹移动到/home目录下:
# mv -t /path/of/gmefi-master/ /home
GemFI安装
在gemfi-master文件夹执行指令如下:
# cd /home/gemfi-master
# scons ./build/ALPHA/gem5.opt
scons: Reading SConscript files ...
……
scons: done building targets.
在./util/term中运行一下指令,以使用m5term:
# cd /home/gemfi-master/util/term
# make
# make install
Addition
在原本的fs.py中315行有
m5.disableAllListeners()
注释掉该行,以实现在终端上的监听。
新版dmtcp中的dmtcp_checkpoint功能更名为dmtcp_launch。在全系统仿真中运行:
# dmtcp_launch build/ALPHA/gem5.opt configs/example/fs.py
ERROR: ld.so: object 'libdmtcp_alloc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libdmtcp_dl.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libdmtcp_ipc.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libdmtcp_timer.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libdmtcp.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object 'libdmtcp_pid.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
I am going to connect to dmtcp
DMTCP:: Error in installing HOOKS
I am going to continue Hoping to restart from a checkpoint
首先找到文件libdmtcp_alloc.so、libdmtcp_dl.so等的所在位置:
# locate libdmtcp_pid.so
/home/dmtcp-2.4.0-rc3/lib/dmtcp/libdmtcp_pid.so
/usr/lib/dmtcp/libdmtcp_pid.so
/usr/local/lib/dmtcp/libdmtcp_pid.so
可以看到,上述文件存在于三个位置。找到/etc/lb.so.conf文件,其中内容为:
# cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
# ls /etc/ld.so.conf.d
fakeroot-i386-linux-gnu.conf i386-linux-gnu_EGL.conf libc.conf
i386-linux-gnu.conf i386-linux-gnu_GL.conf
由此可知,路径存放在文件夹中 .conf文件中。向libc.conf添加路径:
# echo "/usr/local/lib/dmtcp" >> /etc/ld.so.conf.d/libc.conf
# /sbin/ldconfig
再次运行:
# dmtcp_launch build/ALPHA/gem5.opt configs/example/fs.py
dmtcp_coordinator starting...
Host: zoe-Lenovo (127.0.1.1)
Port: 7779
Checkpoint Interval: disabled (checkpoint manually instead)
Exit on last client: 1
Backgrounding...
I am going to connect to dmtcp
DMTCP:Hooks installed successfully 1
warn: No header file specified for SimObject: Fi_System
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jun 25 2015 12:04:59
gem5 started Jun 28 2015 11:02:35
gem5 executing on zoe-Lenovo
command line: build/ALPHA/gem5.opt configs/example/fs.py
Global frequency set at 1000000000000 ticks per second
info: kernel located at: /home/gemfi-master/dist/binaries/vmlinux
Listening for system connection on port 3460
0: system.tsunami.io.rtc: Real-time clock set to Thu Jan 1 00:00:00 2009
0: system.remote_gdb.listener: listening for remote gdb #0 on port 7004
**** REAL SIMULATION ****
info: Entering event queue @ 0. Starting simulation...
warn: Prefetch instructions in Alpha do not do anything
warn: Prefetch instructions in Alpha do not do anything