summaryrefslogtreecommitdiff
path: root/rumpdisk/main.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-06-28 18:22:13 +1000
committerDamien Zammit <damien@zamaudio.com>2023-07-03 19:53:04 +1000
commit0ea9fe2185dadfe4cb4a241c72d3d14a4fde5195 (patch)
treecccbfec0d0562d6c7be42311b39f785fbf7b178b /rumpdisk/main.c
parent955544335bad2db9a1d30b17aead35ad1f5c83be (diff)
rumpusbdisk: Add USB mass storage translatorrumpusbdisk
This adds a second binary target to compile in the rump USB stack instead of SATA/IDE using conditional ifdefs to mostly share the code between the two translators. This can be tested by running qemu with a USB3 controller as follows: -drive if=none,id=usbstick,format=raw,file=/path/to/disk.img \ -device qemu-xhci \ -device usb-storage,drive=usbstick \ NB: /path/to/disk.img can be a block device on the host. Then call grub module rumpusbdisk.static instead of rumpdisk.static and pass ' root=part:X:device:sd0 noide' as gnumach parameters, where X is the partition number of / within the disk/image. (IRQ sharing still seems broken).
Diffstat (limited to 'rumpdisk/main.c')
-rw-r--r--rumpdisk/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/rumpdisk/main.c b/rumpdisk/main.c
index 64065c6c..ca166274 100644
--- a/rumpdisk/main.c
+++ b/rumpdisk/main.c
@@ -32,6 +32,12 @@
#include <pthread.h>
#include <mach.h>
+#ifdef _RUMP_SATA
+#define RUMPNAME "rumpdisk"
+#else
+#define RUMPNAME "rumpusbdisk"
+#endif
+
mach_port_t bootstrap_resume_task = MACH_PORT_NULL;
static const struct argp_option options[] = {
@@ -128,7 +134,7 @@ main (int argc, char **argv)
}
rump_register_block ();
- machdev_trivfs_init (argc, argv, bootstrap_resume_task, "rumpdisk", "/dev/rumpdisk", &bootstrap);
+ machdev_trivfs_init (argc, argv, bootstrap_resume_task, RUMPNAME, "/dev/" RUMPNAME, &bootstrap);
/* Make sure we will not swap out, in case we drive the disk used for
swapping. */