How to attach multiple disk images in a simulation with gem5 fs.py?

谁说我不能喝 提交于 2019-12-20 04:51:03

问题


At https://www.mail-archive.com/gem5-users@gem5.org/msg15233.html Jason mentioned the technique of attaching two disk images to restore a checkpoint and run a different benchmark.

Is it possible to specify multiple disk images when using fs.py? From the source code I don't think it is currently supported, but just double checking before I decided to patch it or not.

It seems that multiple --disk-image= options just overwrite one another.

fs_bigLITTLE.py seems to support it however.

gem5 60600f09c25255b3c8f72da7fb49100e2682093a

https://www.mail-archive.com/gem5-users@gem5.org/msg15675.html


回答1:


I replied here: https://www.mail-archive.com/gem5-users@gem5.org/msg15714.html

Basically, http://www.gem5.org/AsimBench shows an example of how to do it with fs.py. You can try this with this patch:

diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
index e2b6616..e01cc13 100644
--- a/configs/common/FSConfig.py
+++ b/configs/common/FSConfig.py
@@ -266,15 +266,17 @@ def makeArmSystem(mem_mode, machine_type, num_cpus=1, mdesc=None,

    self.cf0 = CowIdeDisk(driveID='master')
    self.cf0.childImage(mdesc.disk())
+   self.disk2 = CowIdeDisk(driveID='master')
+   self.disk2.childImage(disk('workloads.img'))
    # Old platforms have a built-in IDE or CF controller. Default to
    # the IDE controller if both exist. New platforms expect the
    # storage controller to be added from the config script.
    if hasattr(self.realview, "ide"):
-       self.realview.ide.disks = [self.cf0]
+       self.realview.ide.disks = [self.cf0, self.disk2]
    elif hasattr(self.realview, "cf_ctrl"):
-       self.realview.cf_ctrl.disks = [self.cf0]
+       self.realview.cf_ctrl.disks = [self.cf0, self.disk2]
    else:
-       self.pci_ide = IdeController(disks=[self.cf0])
+       self.pci_ide = IdeController(disks=[self.cf0, self.disk2])
        pci_devices.append(self.pci_ide)

    self.mem_ranges = []

Note that in this example, you have to supply an image called workloads.img in your M5_PATH (an environment variable for gem5 pointing the a directorycontaining system files). Of course you can change this to any value youwant or pass it via an option.

Also note that when booted, you have to mount the second disk first by using the normal tools to mount a disk. This can be done by e.g.

sudo mount /dev/sdb1 /mnt

All files in the second disk image will then be present under /mnt



来源:https://stackoverflow.com/questions/50862906/how-to-attach-multiple-disk-images-in-a-simulation-with-gem5-fs-py

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!