一、GemFI的安装
1、预装软件
sudo apt-get install build-essential
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
sudo apt-get install scons
sudo apt-get install swig
sudo apt-get install m4
sudo apt-get install python-dev
sudo apt-get install zlib1g
sudo apt-get install zlib1g-dev
sudo apt-get install protobuf-compiler
sudo apt-get install libprotobuf-dev
2、安装dmtcp-2.2.1和protobuf-2.5.0
在网上下载dmtcp-2.2.1和protobuf-2.5.0两个安装包,并将其放到自己的目录下,例如:/home/cyh/cyh/gemfi,然后根据一般软件的安装方法安装即可。(在这里我使用的是Ubuntu 12.04)
3、安装GemFI
1、修改文件gemfi-x86/configs/common/SysPaths.py第53行,修改为自己路径。例如:
path = [ ‘/dist/m5/system’, ‘/home/cyh/cyh/gemfi/gemfi-x86/dist’ ]
2、修改后在终端进入gemfi-x86文件夹,运行如下指令:
scons build/X86/gem5.opt
第一次安装需要等待20-30分钟左右,安装成功后会显示:
scons: done building targets.
3、编译m5term用于连接进入模拟系统。进入gemfi-x86文件夹下util子目录term,运行如下指令:
make
sudo make install
4、运行例子程序。
从终端进入到gemfi-x86目录:
cd /home/cyh/cyh/gemfi/gemfi-x86
执行下面的指令:
dmtcp_checkpoint build/X86/gem5.opt configs/example/fs.py --kernel=x86_64-vmlinux-2.6.28.4-smp -b mybench_hello
当看到“hello world”的输出时证明GemFI的安装成功了。
二、使用GemFI进行故障注入实验
1、修改hello.c文件
添加故障注入的库文件和语句
hello.c所在的目录下:
/home/cyh/cyh/gemfi/gemfi-x86/tests/test-progs/hello/src
hello.c原内容如下:
#include <stdio.h>
int main()
{
printf("hello world!\n");
return 0;
}
将hello.c修改为如下内容:
#include <m5op.h>
#include <stdio.h>
int main()
{
unsigned