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

跟風遠走 提交于 2019-12-02 06:27:05

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

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