Gem 5 IOError:找不到系统文件的路径。全系统 X86 仿真设置



我已经安装了GEM5。我正在尝试进行完整的系统模拟。我添加了m5_path

echo "export M5_PATH==/home/sam/security/gem5/full/" >> ~/.bashrc

我将所有系统映像和配置文件放在以下目录下:

  :~/security/gem5/full$ ls
binaries  configs  config-x86.tar.bz2  disks  x86-system.tar.bz2  x86-system.tar.bz2.1

我将syspaths.py文件中的路径更改为以下:

                paths = [ '/dist/m5/system', 'full' ]

并在Benchmark.py.py

中更新了以下行
            return env.get('LINUX_IMAGE', disk('linux-x86.img'))

GEM5成功编译了,我正在运行以下内容:

 ./build/X86/gem5.opt configs/example/fs.py  --disk-image=/home/sam/security/gem5/full/disks/linux-x86.img 

,但我会发现一个错误,因为它找不到系统文件的途径。

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/X86/python/m5/main.py", line 438, in main
    exec(filecode, scope)
  File "configs/example/fs.py", line 335, in <module>
    test_sys = build_test_system(np)
  File "configs/example/fs.py", line 93, in build_test_system
    cmdline=cmdline)
  File "/home/sam/security/gem5/configs/common/FSConfig.py", line 614, in makeLinuxX86System
    makeX86System(mem_mode, numCPUs, mdesc, self, Ruby)
  File "/home/sam/security/gem5/configs/common/FSConfig.py", line 539, in makeX86System
    disk0.childImage(mdesc.disk())
  File "/home/sam/security/gem5/configs/common/Benchmarks.py", line 59, in disk
    return disk(self.diskname)
  File "/home/sam/security/gem5/configs/common/SysPaths.py", line 63, in __call__
    raise IOError("Can't find a path to system files.")
IOError: Can't find a path to system files.

更新2020-01

在82F6D6E90F36E400DB1F38EEF5FE17430313458E上进行了审查,请访问https://gem5-review.googlesource.com/c/public/public/public/gem5/gem5/gem5/ 23672/7 cli insanity spli nistanity已大大减少了:

  • 如果明确指出所有必需的文件,则不再需要M5_PATH

    fs.py --kernel path/to/vmlinux --disk-image path/to/rootfs.ext2
    

    不再需要名为linux-bigswap2.imgx86_64-vmlinux-2.6.22.9的第二个磁盘,您可以随意通过多个--disk-image选项传递多个磁盘,请参见:如何使用GEM5 FS.PY在模拟中附加多个磁盘图像?

  • 在ARM上,M5_PATH也可以分配,但您还需要用以下方式指向启动加载程序:

    fs.py --bootloader ./system/arm/bootloader/arm64/boot.arm64
    

如果您错过了任何这些文件,则使用M5_PATH

请注意,就像PATH搜索算法一样,仅在M5_PATH下搜索没有/的路径,因此,如果您想指向当前目录中的文件,则需要添加./,如:

中的:
fs.py --kernel ./vmlinux

另请参阅:为什么需要./(dot-slash(在可执行文件或脚本名称之前以bash运行它?

旧答案

Gem5对某些路径名很挑剔,但是您无需修补它即可实现不错的图像设置。

例如,使用GEM5 E2656006DF442A995BF80EE0EE03FA9700D6EC14537进行此工作设置:

M5_PATH=/full/path/to/system 
  build/X86/gem5.opt 
  configs/example/fs.py 
  --disk-image /any/path/to/rootfs.ext2 
  --kernel /any/path/to/vmlinux

/full/path/to/system包含:

./disks/linux-bigswap2.img
./binaries/x86_64-vmlinux-2.6.22.9

这两个文件都是我从这里生成的假人:

dd if=/dev/zero of=./binaries/linux-bigswap2.img count=1 bs=16k
touch disks/x86_64-vmlinux-2.6.22.9

是的,这对Gem5的自以为是的图像搜索是一个可怕的解决方法...如果您通过--disk-image--kernel自己,请实际修补Gem5不寻找这些图像...

一如既往地尝试使用Prints和PDB进行调试:然后很容易弄清楚为什么某些东西对您不起作用。

最新更新