From c3b3053b9e8ac3c9f70cbe12f884ab8ca69dd991 Mon Sep 17 00:00:00 2001 From: Damien Zammit Date: Mon, 3 Jul 2023 10:18:22 +0000 Subject: rumpusbdisk: Add USB mass storage translator 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. Caveats: netdde seems to exhibit a bug when running 'ifdown /dev/eth0' simultaneously to running the rumpusbdisk translator, due to the two devices sharing the same IRQ. Message-Id: <20230703101815.925760-1-damien@zamaudio.com> --- rumpdisk/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'rumpdisk/main.c') 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 #include +#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. */ -- cgit v1.2.3