1.fs模式需要两个额外的包

  Full System Files : http://www.m5sim.org/dist/current/m5_system_2.0b3.tar.bz2

  linux-dist : http://www.m5sim.org/dist/current/linux-dist.tgz

2.安装(gem5安装目录为cb@ubuntu:~/gem5$ )    

  a)$ mkdir dist

  b) 将包m5_system_2.03.tar.bz2 复制到dist目录

  c) 解压 ~gem5/dist$ tar -xvf m5_system_2.03.tar.bz2

  d)解压后的文件夹内容放到dist目录下

     ~/gem5/dist$ cd m5_system_2.0b3/

    ~/gem5/dist/m5_system_2.0b3$ mv./binaries/ ../binaries

     ~/gem5/dist/m5_system_2.0b3$ mv./disks/ ../disks

    ~/gem5/dist$ rm -rfm5_system_2.0b3
  e)修改$GEM5/config/common/SysPath.py 文件:
    把exceptKeyError:path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system
    修改成
    except KeyError:
           path = [ '/dist/m5/system', ' /home/<用户名>/gem5/dist' ]

3运行

     进入gem5目录 ./build/ALPHA/gem5.opt ./configs/example/fs.py

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

gem5 compiled Apr 18 2016 19:51:09
gem5 started Apr 20 2016 06:09:41
gem5 executing on ubuntu
command line: ./build/ALPHA/gem5.opt ./configs/example/fs.py

Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
info: kernel located at: /home/cb/gem5/dist/binaries/vmlinux
Listening for system connection on port 3456
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 7000
**** 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

4 开启新终端,使用M5Term来与simulatedsystem进行交互

~/gem5$cd ./util/term
~/gem5$make
~/gem5$sudo make install
~/gem5$m5term localhost 3456

ls

EXT2-fs warning: checktime reached, running e2fsck is recommended
loading script...
Script from M5 readfile is empty, starting bash shell...
# ls
benchmarks  etc         linuxrc     modules     sys         usr
bin         iscsi       lost+found  proc        testGem5    var
dev         lib         mnt         sbin        tmp
# 

 

5 testGem5文件夹

1、将ALPHA下编译好的hello执行文件拷贝到当前路径(也可以自己交叉编译)
~/gem5$ cp./tests/test-progs/hello/bin/alpha/linux/hello ./hello
2、挂载
~/gem5$ sudo mount -o,loop,offset=32256 ./dist/disks/linux-latest.img /mnt
偏移量32256=63*512
3、显示一下/mnt,可以看到挂载好的操作系统
~@ubuntu:/mnt$ ls
benchmarks  dev  iscsi  linuxrc     mnt      proc  sys  usr
bin         etc  lib    lost+found  modules  sbin  tmp  var

4、加待运行的hello
~@ubuntu:/mnt$ sudo mkdir testGem5
~@ubuntu:/mnt$ cd ../home/~/gem5/
~@ubuntu:~/gem5$ sudo cp hello /mnt/testGem5
~@ubuntu:~/gem5$ cd /mnt
~@ubuntu:/mnt$ ls
benchmarks  dev  iscsi  linuxrc     mnt      proc  sys       tmp  var
bin         etc  lib    lost+found  modules  sbin  testGem5  usr
~@ubuntu:/mnt$ ls testGem5
hello

5、  在使用linux的image文件之前,应该执行umount操作。
~/gem5$ sudo umount /mnt

 

6.测试

  1,运行fs模式./build/ALPHA/gem5.opt ./configs/example/fs.py

  2,新终端,./util/term/m5term localhost 3456

# ls                               
benchmarks  etc         linuxrc     modules     sys         usr
bin         iscsi       lost+found  proc        testGem5    var
dev         lib         mnt         sbin        tmp
# cd testGem5
# ls
hello
# ./hello
Hello world!
# 

 

posted on 2016-04-20 21:33  chaob  阅读(2084)  评论(0编辑  收藏  举报