[PATCH 4/5] scripts: qemu_interactive.py: add new --usbblk option
Ahmad Fatoum
a.fatoum at barebox.org
Fri Jun 26 05:45:45 PDT 2026
To be able to easily exercise the new xhci-pci support, add into
qemu_interactive.py a new --usbblk option that behaves like --blk, but
instead of creating a Virt I/O block device, creates a removable USB
storage.
As the ARM 64-bit Virt machine has no USB host by default, enable
xhci-pci there, so it can be readily used.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
scripts/qemu_interactive.py | 10 ++++++++++
test/arm/virt at multi_v8_defconfig.yaml | 1 +
2 files changed, 11 insertions(+)
diff --git a/scripts/qemu_interactive.py b/scripts/qemu_interactive.py
index a8605d23b132..827a831725ba 100755
--- a/scripts/qemu_interactive.py
+++ b/scripts/qemu_interactive.py
@@ -49,6 +49,9 @@ def register_shared_options(parser):
_add_option(parser, "--blk", action="append", dest="qemu_block",
default=[], metavar="FILE",
help="Pass block device to emulated barebox. Can be specified more than once")
+ _add_option(parser, "--usbblk", action="append", dest="qemu_usbblock",
+ default=[], metavar="FILE",
+ help="Pass USB block device to emulated barebox. Can be specified more than once")
_add_option(parser, "--env", action="append", dest="qemu_fw_cfg",
type=_assignment, default=[],
metavar="[envpath=]content | [envpath=]@filepath",
@@ -257,6 +260,13 @@ def apply_shared_options(strategy, target, options, *, interactive, fail=None):
else:
fail("--blk unsupported for target\n")
+ for i, blk in enumerate(_get_list_option(options, "qemu_usbblock")):
+ _append_qemu_args(
+ strategy, fail,
+ "-drive", f"if=none,format=raw,id=usbstorage{i},file={blk}",
+ "-device", f"usb-storage,drive=usbstorage{i},bus=usb-bus.0,removable=on"
+ )
+
envopts = {}
for i, fw_cfg in enumerate(_get_list_option(options, "qemu_fw_cfg")):
diff --git a/test/arm/virt at multi_v8_defconfig.yaml b/test/arm/virt at multi_v8_defconfig.yaml
index 4eb75da4610e..60707c951c2e 100644
--- a/test/arm/virt at multi_v8_defconfig.yaml
+++ b/test/arm/virt at multi_v8_defconfig.yaml
@@ -8,6 +8,7 @@ targets:
memory: 1024M
bios: barebox-qemu-virt.img
display: qemu-default
+ extra_args: '-device qemu-xhci'
BareboxDriver:
prompt: 'barebox@[^:]+:[^ ]+ '
bootstring: 'commandline:'
--
2.47.3
More information about the barebox
mailing list