Would it be useful to have a virtio driven R/W disk image
Closed this issue · 4 comments
Related to issue riscv-software-src/riscv-isa-sim#1549
Following the hints, we have implemented an extension of this spike-device, which is able to mount an ext4 disk image inside the Spike running linux kernel using the existing virtio driver. Compared with iceblk, we think there are two benefits:
- No need to load a kernel module at runtime, as the virtio driver is already available in buildroot.
- The mounted disk image is writable (so the files created and modified during simulation persist after the simulation).
Our extension is available here: https://github.com/comparch-security/spike-devices
We will have some clean up and further development (hopefully to implement virtio-9P for dir share)
We are wondering whether ucb-bar would like a PR? If so, are there any further suggestions for us?
Thanks @jerryz123 for the valuable hints!
The spike-devices API can support an ecosystem of independently developed and maintained device models.
Thus, I think its better if you maintain your own repo implementing the virtio device. If you change the name of the installed dynamic library from libspikedevices (libspikevirtio, for instance), then both libraries can be used without conflict.
The virtio support is very useful, I'm very glad to see you got this working. We may try to use that in some of our own development as well.
@jerryz123 Wouldn't it be nice to PR this in into our repo with some cleanup?
The virtio device @wsong83 implemented is orthogonal to the random devices already in this repo, there is no code or functionality that needs to be shared.
The device-in-shared-lib model in Spike already supports building devices in independent libraries, and selectively linking them at the command line. Maintaining two separate repos for these independent projects is better.
I see. No problem at all.