Gem 5 IOError: Can't find a path to system files. Full System X86 simulation setup

后端 未结 1 1270
夕颜
夕颜 2020-12-11 13:16

I\'ve already got Gem5 installed. I\'m trying to do a full system simulation. I added M5_PATH

echo \"export M5_PATH==/home/sam/security/gem5/full/\" >&         


        
相关标签:
1条回答
  • 2020-12-11 13:57

    Update 2020-01

    As of 82f6d6e90f36e400db1f38eef5fe17430313458e reviewed at https://gem5-review.googlesource.com/c/public/gem5/+/23672/7 the CLI insanity has reduced substantially:

    • M5_PATH is not required anymore on X86 if you point to all required files explicitly:

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

      The second disk named linux-bigswap2.img and x86_64-vmlinux-2.6.22.9 are not needed anymore, and you can pass multiple disks at will with multiple --disk-image options, see: How to attach multiple disk images in a simulation with gem5 fs.py?

    • on ARM, M5_PATH can also be dispensed, but you also need to point the bootloader with:

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

    If you miss any of those files, M5_PATH gets used.

    Note that just like the PATH search algorithm, paths without / are only searched under M5_PATH, so if you want to point to a file in the current directory you need to add ./ as in:

    fs.py --kernel ./vmlinux
    

    see also: Why do you need ./ (dot-slash) before executable or script name to run it in bash?

    Old answer

    gem5 is picky about some path names, but you don't need to patch it to achieve a decent image setup.

    For example, this working setup with gem5 e2656006df442a995bf80ee03fa9700d6ec14537 essentially runs:

    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
    

    and /full/path/to/system contains:

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

    Both of those files are dummies which I generated from here with:

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

    Yes, this is a horrible workaround to gem5's opinionated image searching... someone should really patch gem5 to not look for those images if you pass --disk-image and --kernel yourself...

    As always, have a try at debugging it with prints and PDB: it should then be simple to figure out why something didn't work for you.

    0 讨论(0)
提交回复
热议问题