Skip to content

QEMU: support USB cdrom devices for the Windows 10 Arm64 installer

Jan-Marek Glogowski requested to merge jmux/libvirt:qemu-usb-cdrom into master

I'm trying to install Windows 10 Arm64 using libvirt. I have a manual QEMU call, which will correctly create USB cdrom devices using the (old) drive syntax:

-device nec-usb-xhci \
-device usb-storage,drive=install \
-drive if=none,id=install,format=raw,media=cdrom,readonly,file=/tmp/win10_arm64_wim_18363.959_en-us.iso \
-device usb-storage,drive=drivers \
-drive if=none,id=drivers,format=raw,media=cdrom,readonly,file=/tmp/virtio-win-0.1.187.iso \

This way the installer sees it's install media and the driver / virtio ISO.

libvirt instead creates the following following blockdev syntax:

-blockdev '{"driver":"file","filename":"/tmp/win10_arm64_wim_18363.959_en-us.iso","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"raw","file":"libvirt-3-storage"}' \
-device usb-storage,bus=usb.0,port=1,drive=libvirt-3-format,id=usb-disk0,bootindex=1,removable=on \

This loses the important information, that the USB device is a cdrom, so the installer won't find itself. Without the removable=on, it sees no devices at all. Turning the devices into "USB sticks" will just make the the installer see them, but it still can't access the filesystem.

From all I have read in the qemu code, the current -blockdev-based syntax can't support usb-storage cdroms. Other block device frontends have explicit -hd and -cd variants (ide, scsi). The most proper fix would probably be to add a media flag to the usb-storage device in QEMU, but OTOH ide-drive and scsi-disk were deprecated in QEMU. And it won't fix current QEMU versions, so the atached patch generates the old commandline options jut for USB cdroms.

Merge request reports