runqemu: add virtio block device

Implement new QB_DRIVE_TYPE="/dev/vdb" which falls back
to virtio block device emulated by qemu.
That is needed to support following qemu command line:
-drive id=disk0,file=%s,if=none,format=%s \
  -device virtio-blk-device,drive=disk0'

Real use case is arm64 emulation with qemu with atf+optee+uboot,
so that uboot driver sees this disk and able to load from it.

(From OE-Core rev: 4d72cd395b2dd40dde1f3809e3ab255938e6a7a1)

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Maxim Uvarov 2020-01-04 23:08:57 +03:00 committed by Richard Purdie
parent 0560b812c9
commit 9ac151b744

View File

@ -1196,6 +1196,9 @@ class BaseConfig(object):
elif drive_type.startswith("/dev/hd"): elif drive_type.startswith("/dev/hd"):
logger.info('Using ide drive') logger.info('Using ide drive')
vm_drive = "-drive file=%s,format=%s" % (self.rootfs, rootfs_format) vm_drive = "-drive file=%s,format=%s" % (self.rootfs, rootfs_format)
elif drive_type.startswith("/dev/vdb"):
logger.info('Using block virtio drive');
vm_drive = '-drive id=disk0,file=%s,if=none,format=%s -device virtio-blk-device,drive=disk0' % (self.rootfs, rootfs_format)
else: else:
# virtio might have been selected explicitly (just use it), or # virtio might have been selected explicitly (just use it), or
# is used as fallback (then warn about that). # is used as fallback (then warn about that).