-
Notifications
You must be signed in to change notification settings - Fork 8
USB Storage
Using a USB drive with Mini404 currently requires a raw image of the drive to be taken. You can use dd
or any other tool as you wish, or create an empty FAT32 image with MK404 and copy files to it using mcopy
. If cloning a drive to an image, be sure to image only the partition (e.g. /dev/sdcX
and not the full drive /dev/sdc
)
To attach the drive to the system, pass the following command line arguments to qemu-system-buddy
:
-
-drive id=usbstick,format=raw,file=[filename.img]
to tell QEMU you wish to use a file as a virtual disk -
-device usb-storage,drive=usbstick
to instruct it to attach the named drive (usbstick
) as a USB Mass Storage Controller.
Read-only images can be mounted by explicitly requesting readonly=on
in the -drive
option:
-drive id=usbstick,format=raw,readonly=on,file=[filename.img]
- Workaround: Do not hotplug usb drives with device_add in the QEMU console. Connect them at startup with
-device usb-storage
options.
❌ Do not attach devices other than USB storage, including virtual hubs. The Mini firmware does not like that, and we've had to prevent QEMU automatically adding a hub as part of the mainline chainges for this project!
If you get this error:
qemu-system-buddy: -device usb-storage,drive=usbstick: 'usb-storage' is not a valid device model name
it just means you need to rerun the configure
build tool with the --enable-libusb
argument.
QEMU has a vvfat
driver which can mount a directory of files acting act as the contents of the USB stick. This is read-only by default and can be done with the following argument set:
-drive id=usbstick,readonly=on,file=fat:some/directory
The vvfat
device can optionally be made read-write with the following:
-drive id=usbstick,file=fat:rw:some/directory
Note that read-write support is experimental and care should be taken not to modify the directory on the host machine while the guest is running.
Do not forget after the drive definition to put there also
-
-device usb-storage,drive=usbstick
to instruct it to attach the named drive (usbstick
) as a USB Mass Storage Controller.