diff options
| author | Claus Stovgaard <clst@ambu.com> | 2021-12-21 22:44:18 +0100 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2021-12-21 18:49:37 -0800 |
| commit | 6a271fd4289c27f1291739e7c9874dbe6e0c2d6d (patch) | |
| tree | 5edfe0c5905d3e39e1dc0f4b508e825f051529b8 | |
| parent | 35aa5959c6bc2fa0458b90f4892cffd1da8189f0 (diff) | |
| download | meta-openembedded-6a271fd4289c27f1291739e7c9874dbe6e0c2d6d.tar.gz | |
Added usbip-tools for kernel USB/IP
Userspace tool from the kernel. Used for control the client/server of
USB/IP. The server expect USB devices and the client import them on the
client machine. Making it look like a device is physical connected to
the client, even though it is physical connected to the server.
Signed-off-by: Claus Stovgaard <clst@ambu.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb b/meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb new file mode 100644 index 0000000000..a2b0dea550 --- /dev/null +++ b/meta-oe/recipes-kernel/usbip-tools/usbip-tools.bb | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | # Recipe for building userspace part of USB/IP | ||
| 2 | # | ||
| 3 | # Started with work from chuck kamas - 2021-11-05 | ||
| 4 | # https://lists.yoctoproject.org/g/yocto/topic/86249103?p=,,,20,0,0,0::recentpostdate/sticky,,,20,0,0,86249103 | ||
| 5 | # Though have rewritten all the logic to be much simpler | ||
| 6 | # | ||
| 7 | # SPDX-License-Identifier: MIT | ||
| 8 | # | ||
| 9 | # Author(s) | ||
| 10 | # clst@ambu.com (Claus Stovgaard) | ||
| 11 | # | ||
| 12 | |||
| 13 | SUMMARY = "userspace usbip from Linux kernel tools" | ||
| 14 | DESCRIPTION = " USB/IP protocol allows to pass USB device from server to \ | ||
| 15 | client over the network. Server is a machine which provides (shares) a \ | ||
| 16 | USB device. Client is a machine which uses USB device provided by server \ | ||
| 17 | over the network. The USB device may be either physical device connected \ | ||
| 18 | to a server or software entity created on a server using USB gadget subsystem." | ||
| 19 | |||
| 20 | LICENSE = "GPLv2" | ||
| 21 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" | ||
| 22 | DEPENDS = "virtual/kernel udev" | ||
| 23 | PROVIDES = "virtual/usbip-tools" | ||
| 24 | |||
| 25 | inherit kernelsrc autotools-brokensep | ||
| 26 | |||
| 27 | do_configure[depends] += "virtual/kernel:do_shared_workdir" | ||
| 28 | |||
| 29 | # We need to set S, for not being set to STAGING_KERNEL_DIR, and by that | ||
| 30 | # be wiped when we prune dest below. We just set it to usbip-tools-1.0 | ||
| 31 | S = "${WORKDIR}/${BP}" | ||
| 32 | |||
| 33 | # Copy the source files from KERNEL/tools/usb/usbip to ${S} | ||
| 34 | do_configure[prefuncs] += "copy_usbip_source_from_kernel" | ||
| 35 | python copy_usbip_source_from_kernel() { | ||
| 36 | dir_in_kernel = "tools/usb/usbip" | ||
| 37 | src_dir = d.getVar("STAGING_KERNEL_DIR") | ||
| 38 | src = oe.path.join(src_dir, dir_in_kernel) | ||
| 39 | dest = d.getVar("S") | ||
| 40 | bb.utils.mkdirhier(dest) | ||
| 41 | bb.utils.prunedir(dest) | ||
| 42 | # copy src to dest folder | ||
| 43 | if not os.path.exists(src): | ||
| 44 | bb.fatal("Path does not exist: %s. Maybe dir_in_kernel does not match the kernel version." % src) | ||
| 45 | if os.path.isdir(src): | ||
| 46 | oe.path.copyhardlinktree(src, dest) | ||
| 47 | else: | ||
| 48 | src_path = os.path.dirname(src) | ||
| 49 | os.makedirs(os.path.join(dest,src_path),exist_ok=True) | ||
| 50 | bb.utils.copyfile(src, dest) | ||
| 51 | } | ||
| 52 | |||
| 53 | # Use local scripts before relying on inherited autotools | ||
| 54 | do_configure () { | ||
| 55 | # We are in ${B} - equal to ${S}, so just run the scripts | ||
| 56 | ./cleanup.sh || bbnote "${PN} failed to cleanup.sh" | ||
| 57 | ./autogen.sh || bbnote "${PN} failed to autogen.sh" | ||
| 58 | oe_runconf | ||
| 59 | } | ||
| 60 | |||
| 61 | # As usbip integrate with the kernel module, we set this package to be build specific for | ||
| 62 | # this machine, and not generally for the architecture | ||
| 63 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
| 64 | |||
| 65 | # Even though the libusbip is set to version 0.0.1, set the package version to match kernel | ||
| 66 | # e.g. usbip-tools-5.14.21-r0.qemux86_64.rpm for qemu package using kernel 5.14.21 | ||
| 67 | python do_package:prepend() { | ||
| 68 | d.setVar('PKGV', d.getVar("KERNEL_VERSION", True).split("-")[0]) | ||
| 69 | } \ No newline at end of file | ||
