我已经安装了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中的以下行
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.
答案 0 :(得分:1)
gem5对某些路径名称有些挑剔,但您无需修补它即可实现不错的图像设置。
例如,带有gem5 e2656006df442a995bf80ee03fa9700d6ec14537的this working setup本质上可以运行:
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
这两个文件都是我用from here生成的假人:
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而不查找那些图像...
像往常一样,尝试使用打印和PDB对其进行调试:然后应该很容易弄清楚为什么某些东西对您不起作用。