Ubuntu 20.04 LTS 安装gem5

1、安装依赖包

sudo apt-get install build-essential 
sudo apt-get install git 
sudo apt-get install m4 
sudo apt-get install scons 
sudo apt-get install zlib1g 
sudo apt-get install zlib1g-dev 
sudo apt-get install libprotobuf-dev 
sudo apt-get install protobuf-compiler 
sudo apt-get install libprotoc-dev 
sudo apt-get install libgoogle-perftools-dev 
sudo apt-get install python3-dev 
sudo apt-get install python3
sudo apt-get install python3-pip
sudo apt-get install libhdf5-dev
sudo apt-get install libpng-dev
pip install pydot -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pypng -i https://pypi.tuna.tsinghua.edu.cn/simple

2、下载源代码

git clone https://gem5.googlesource.com/public/gem5

或者

git clone https://github.com/gem5/gem5.git

3、进入gem5文件夹

cd gem5

4、编译

gem5的编译需要大量的内存,小于8GB内存可能会报错。如果在虚拟机上运行,建议编译前设置交换区。

scons build/{arch}/gem5.opt -j N

其中{arch}为指令集架构。目前gem5支持的架构有:

  • x86
  • arm (arm-linux-gnueabihf-gcc)
  • thumb (arm-linux-gnueabihf-gcc)
  • sparc (sparc64-linux-gnu-gcc)
  • arm64 (aarch64-linux-gnu-gcc)
  • riscv (riscv64-linux-gnu-gcc)
    -j表示开启多线程加速,N为线程数。
    该编译过程用时较长,需耐心等待。
    出现如下信息表示编译正常结束:
scons: done building targets.

5、测试

./build/RISCV/gem5.opt ./configs/example/se.py -c ./tests/test-progs/hello/bin/riscv/linux/hello

屏幕上出现如下信息则表示安装成功。

gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 version 21.2.1.1
gem5 compiled Jun  6 2022 13:56:34
gem5 started Jun  6 2022 14:01:31
gem5 executing on NUDT, pid 24895
command line: ./build/RISCV/gem5.opt ./configs/example/se.py -c ./tests/test-progs/hello/bin/riscv/linux/hello

Global frequency set at 1000000000000 ticks per second
warn: failed to generate dot output from m5out/config.dot
build/RISCV/mem/mem_interface.cc:791: warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
**** REAL SIMULATION ****
build/RISCV/sim/simulate.cc:194: info: Entering event queue @ 0.  Starting simulation...
build/RISCV/sim/mem_state.cc:443: info: Increasing stack size by one page.
Hello world!
Exiting @ tick 3339000 because exiting with last active thread context

6、问题及解决方法

编译gem5时遇到的问题大多是由内存不足造成的,如:

Error: open CFI at the end of file;

物理机加内存;虚拟机设置更大的交换区空间,或者重启以清空交换区。

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值