From 26cdf42b8a4d8f15768f93cf0895a359a3412638 Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Mon, 12 Dec 2022 12:41:38 +0100 Subject: virtio-loopback: v5: Add recipes for virtio-loopback support Includes the virtio-loopback kernel module, the adapter application, the vhost-user devices from QEMU and a Rust vhost-user-rng device implementation. v2: Update recipes to conform with the OE-Styleguide v3: Recipes fixes for generic builds v4: Generalize the recipes to build for different architectures v5: Update recipes to comply with the OE-Styleguide Change-Id: I67c14fd77e564c0aecdde40dc1cf7e893dae6de1 Signed-off-by: Angelos Mouzakitis --- .../loopbackdriver.bb | 14 +++++++ .../recipes-kernel/linux/linux-yocto-dev.bbappend | 5 +++ .../linux/linux-yocto/virtio_loopback.cfg | 2 + .../recipes-kernel/linux/linux-yocto_%.bbappend | 5 +++ .../qemu-vhost-user-devices.bb | 48 ++++++++++++++++++++++ ...ray-terminate-entry-for-arg-parsing-optio.patch | 23 +++++++++++ .../recipes-virtioloopback/adapter/adapter.bb | 21 ++++++++++ .../rust-vhost-device/rust-vhost-device_git.bb | 16 ++++++++ 8 files changed, 134 insertions(+) create mode 100644 meta-egvirt/recipes-kernel/kernel-module-virtio-loopback/loopbackdriver.bb create mode 100644 meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_loopback.cfg create mode 100644 meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices.bb create mode 100644 meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices/0001-Add-NULL-array-terminate-entry-for-arg-parsing-optio.patch create mode 100644 meta-egvirt/recipes-virtioloopback/adapter/adapter.bb create mode 100644 meta-egvirt/recipes-virtioloopback/rust-vhost-device/rust-vhost-device_git.bb (limited to 'meta-egvirt') diff --git a/meta-egvirt/recipes-kernel/kernel-module-virtio-loopback/loopbackdriver.bb b/meta-egvirt/recipes-kernel/kernel-module-virtio-loopback/loopbackdriver.bb new file mode 100644 index 00000000..d5c13a21 --- /dev/null +++ b/meta-egvirt/recipes-kernel/kernel-module-virtio-loopback/loopbackdriver.bb @@ -0,0 +1,14 @@ +SUMMARY = "Virtio-loopback driver" +DESCRIPTION = "Virtio-Loopback kernel driver" +LICENSE = "GPL" +LIC_FILES_CHKSUM = "file://README.md;md5=c912e5645ed908bc9570ba05c92b3723" + +inherit module + +SRC_URI = "git://git.virtualopensystems.com/virtio-loopback/loopback_driver.git;protocol=https;rev=02c2bb2980bf307aa654d908f3d54ce2c01d2d92;branch=beta-release" + +S = "${WORKDIR}/git" + +MAKE_TARGETS = "-C ${STAGING_KERNEL_DIR} M=${WORKDIR}/git MODULE_GIT_REPOSITORY_DIR=${METADIR}/meta-agl-devel" +MODULES_INSTALL_TARGET = "-C ${STAGING_KERNEL_DIR} M=${WORKDIR}/git modules_install" + diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend b/meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend index 750be259..f1388a33 100644 --- a/meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend +++ b/meta-egvirt/recipes-kernel/linux/linux-yocto-dev.bbappend @@ -12,3 +12,8 @@ SRC_URI:append = " \ file://virtio_bt.cfg \ file://0002-Bluetooth-virtio_bt-fix-device-removal.patch \ " + +# virtio loopback +SRC_URI += " \ + file://virtio_loopback.cfg \ +" diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_loopback.cfg b/meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_loopback.cfg new file mode 100644 index 00000000..d20575e4 --- /dev/null +++ b/meta-egvirt/recipes-kernel/linux/linux-yocto/virtio_loopback.cfg @@ -0,0 +1,2 @@ +CONFIG_HW_RANDOM_VIRTIO=m +CONFIG_VIRTIO_INPUT=y diff --git a/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend b/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend index d646f535..b75875ba 100644 --- a/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend +++ b/meta-egvirt/recipes-kernel/linux/linux-yocto_%.bbappend @@ -11,3 +11,8 @@ SRC_URI += " \ file://virtio_bt.cfg \ file://0002-Bluetooth-virtio_bt-fix-device-removal.patch \ " + +# virtio loopback +SRC_URI += " \ + file://virtio_loopback.cfg \ +" diff --git a/meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices.bb b/meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices.bb new file mode 100644 index 00000000..2e7eeef5 --- /dev/null +++ b/meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices.bb @@ -0,0 +1,48 @@ +BBCLASSEXTEND = "" +SUMMARY = "Fast open source processor emulator" +DESCRIPTION = "Recipe for vhost-user-rng -blk and -input" +HOMEPAGE = "http://qemu.org" +LICENSE = "GPL-2.0-only & LGPL-2.1-only" +LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ + file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" + +inherit pkgconfig + +DEPENDS = "glib-2.0 zlib pixman bison-native ninja-native" +SRC_URI = "git://git.virtualopensystems.com/virtio-loopback/qemu.git;protocol=https;branch=beta-release \ + file://0001-Add-NULL-array-terminate-entry-for-arg-parsing-optio.patch \ + " +SRCREV = "bf75006d5415b4e485f0bc30b8d7461b3616e9ca" +S = "${WORKDIR}/git" + +UPSTREAM_CHECK_REGEX = "qemu-(?P\d+(\.\d+)+)\.tar" + +# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html +# upstream states qemu doesn't work without optimization +DEBUG_BUILD = "0" + +export LIBTOOL="${HOST_SYS}-libtool" + +B = "${WORKDIR}/build" + +do_configure() { + unset bindir libdir mandir datadir includedir libexecdir + # Pass empty --cross-prefix to suspend errors due to build configurations + # on different architectures. CC/CXX and other build variables are set by Yocto + # itself correct. + ${S}/configure --cross-prefix= +} +do_configure[cleandirs] += "${B}" + +do_install() { + mkdir ${D}/usr/bin/ -p + install -m 0755 ${S}/../build/contrib/vhost-user-input/vhost-user-input ${D}/usr/bin/ + install -m 0755 ${S}/../build/contrib/vhost-user-blk/vhost-user-blk ${D}/usr/bin/ + install -m 0755 ${S}/../build/tools/vhost-user-rng/vhost-user-rng ${D}/usr/bin/ +} + +FILES:${PN} += "/usr/bin" +RDEPENDS:${PN}:class-target += "bash" + +DISABLE_STATIC = "" + diff --git a/meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices/0001-Add-NULL-array-terminate-entry-for-arg-parsing-optio.patch b/meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices/0001-Add-NULL-array-terminate-entry-for-arg-parsing-optio.patch new file mode 100644 index 00000000..a7af1b68 --- /dev/null +++ b/meta-egvirt/recipes-qemu/qemu-vhost-user-devices/qemu-vhost-user-devices/0001-Add-NULL-array-terminate-entry-for-arg-parsing-optio.patch @@ -0,0 +1,23 @@ +From 729065c67520aed4ded15092fd394e2841dc2e0c Mon Sep 17 00:00:00 2001 +From: Angelos Mouzakitis +Date: Thu, 1 Dec 2022 22:07:07 +0100 +Subject: [PATCH] Add NULL array-terminate entry for arg-parsing options + +--- + contrib/vhost-user-blk/vhost-user-blk.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c +index 725583ec4d..f8833e52d1 100644 +--- a/contrib/vhost-user-blk/vhost-user-blk.c ++++ b/contrib/vhost-user-blk/vhost-user-blk.c +@@ -627,7 +627,8 @@ static GOptionEntry entries[] = { + {"blk-file", 'b', 0, G_OPTION_ARG_FILENAME, &opt_blk_file, + "block device or file path", "PATH"}, + { "read-only", 'r', 0, G_OPTION_ARG_NONE, &opt_read_only, +- "Enable read-only", NULL } ++ "Enable read-only", NULL }, ++ { NULL }, + }; + + int main(int argc, char **argv) diff --git a/meta-egvirt/recipes-virtioloopback/adapter/adapter.bb b/meta-egvirt/recipes-virtioloopback/adapter/adapter.bb new file mode 100644 index 00000000..1cff4baf --- /dev/null +++ b/meta-egvirt/recipes-virtioloopback/adapter/adapter.bb @@ -0,0 +1,21 @@ +SUMMARY = "Adapter application" +DESCRIPTION = "Application description here" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://README.md;md5=ecc9c54ada6f0c33054d3bde010744f7" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-${PV}:" +SRC_URI = "git://git.virtualopensystems.com/virtio-loopback/adapter_app.git;protocol=https;rev=da82d88bd72cc9e11b4df11d0b594d3554a75d4f;branch=beta-release" +S = "${WORKDIR}/git" + +do_compile() { + cd ${S} + make +} + +do_install() { + mkdir ${D}/usr/bin/ -p + install -m 0755 ${S}/adapter ${D}/usr/bin/ +} + +DEPENDS = "" +FILES:${PN} += "/usr/bin/adapter" diff --git a/meta-egvirt/recipes-virtioloopback/rust-vhost-device/rust-vhost-device_git.bb b/meta-egvirt/recipes-virtioloopback/rust-vhost-device/rust-vhost-device_git.bb new file mode 100644 index 00000000..1de6fa59 --- /dev/null +++ b/meta-egvirt/recipes-virtioloopback/rust-vhost-device/rust-vhost-device_git.bb @@ -0,0 +1,16 @@ +SUMMARY = "VHOST device in rust" +HOMEPAGE = "https://git.virtualopensystems.com/virtio-loopback/vhost-user-rng-rust/vhost-device" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM="file://README.md;md5=b92c66b94b87c250f37ea0234c9e2d9a" + +inherit cargo + +SRC_URI = "git://git.virtualopensystems.com/virtio-loopback/vhost-user-rng-rust/vhost-device.git;protocol=https;rev=9ff74d7bbc71852b020f62c3663faca41595d4a9" +SRC_URI += "git://git.virtualopensystems.com/virtio-loopback/vhost-user-rng-rust/vhost.git;protocol=https;rev=89fcc56b86b1f165c5b00144df26430a07e1a051;destsuffix=vhost" +SRC_URI += "git://git.virtualopensystems.com/virtio-loopback/vhost-user-rng-rust/vhost-user-backend.git;protocol=https;rev=78ce5fc3ba73e5ac359dcd030b1e8b08ee7e9f2c;destsuffix=vhost-user-backend" +SRC_URI += "git://git.virtualopensystems.com/virtio-loopback/vhost-user-rng-rust/vm-virtio.git;protocol=https;rev=edb16fd8900c14c17c3ab781160aac87813d3b4a;destsuffix=vm-virtio" + +S = "${WORKDIR}/git" + +BBCLASSEXTEND = "native" +CARGO_DISABLE_BITBAKE_VENDORING = "1" -- cgit 1.2.3-korg