aboutsummaryrefslogtreecommitdiff
path: root/rumpdisk/block-rump.c
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2023-07-03 10:18:22 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-07-03 13:40:09 +0200
commitc3b3053b9e8ac3c9f70cbe12f884ab8ca69dd991 (patch)
tree6f1b22534ba93ff543080ae050f89761677f4598 /rumpdisk/block-rump.c
parentf214d0723240cbbe0f1ccb90af8d1b0bb095837f (diff)
downloadhurd-c3b3053b9e8ac3c9f70cbe12f884ab8ca69dd991.tar.gz
hurd-c3b3053b9e8ac3c9f70cbe12f884ab8ca69dd991.tar.bz2
hurd-c3b3053b9e8ac3c9f70cbe12f884ab8ca69dd991.zip
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>
Diffstat (limited to 'rumpdisk/block-rump.c')
-rw-r--r--rumpdisk/block-rump.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/rumpdisk/block-rump.c b/rumpdisk/block-rump.c
index 5ceb14ae..a29ebe73 100644
--- a/rumpdisk/block-rump.c
+++ b/rumpdisk/block-rump.c
@@ -48,6 +48,12 @@
#define DISK_NAME_LEN 32
#define MAX_DISK_DEV 2
+#ifdef _RUMP_SATA
+#define RUMP_TYPE_STRING "rump SATA/IDE"
+#else
+#define RUMP_TYPE_STRING "rump USB"
+#endif
+
static bool disabled;
static mach_port_t master_host;
@@ -107,7 +113,11 @@ is_disk_device (const char *name)
{
const char *dev;
const char *allowed_devs[MAX_DISK_DEV] = {
+#ifdef _RUMP_SATA
"wd",
+#else
+ "sd",
+#endif
"cd"
};
uint8_t i;
@@ -158,7 +168,7 @@ rumpdisk_device_init (void)
{
device_close (device);
mach_port_deallocate (mach_task_self (), device);
- fprintf(stderr, "Kernel is already driving an IDE device, skipping probing disks\n");
+ fprintf(stderr, "Kernel is already driving an IDE device, skipping probing " RUMP_TYPE_STRING " disks\n");
fflush(stderr);
disabled = 1;
return;
@@ -172,7 +182,7 @@ rumpdisk_device_init (void)
{
device_close (device);
mach_port_deallocate (mach_task_self (), device);
- fprintf(stderr, "Kernel is already driving a SATA device, skipping probing disks\n");
+ fprintf(stderr, "Kernel is already driving a SATA device, skipping probing " RUMP_TYPE_STRING " disks\n");
fflush(stderr);
disabled = 1;
return;