Re: building the kernel's usbipd daemon


Nicolas Jeker
 

On Fri, 2021-11-05 at 15:02 -0700, chuck kamas via
lists.yoctoproject.org wrote:
Well it turns out that following the Perf recipe was not only a good
idea, but absolutely necessary. The perf recipe copies the code out of
the work-shared kernel directory into the perf build directory. This
avoids the error when bitbake thinks that the kernel code is not needed
anymore and removes it.


Please see my version of the USBIP recipe below.


Question, how does one get this into the recipe database?
I'm not sure where this belongs, but maybe you can try to submit it to
the meta-oe repository. Look at the readme[1] for instructions.

[1]: https://git.openembedded.org/meta-openembedded/tree/meta-oe/README


Again thanks for the help!

Chuck

SUMMARY = "USBip part of Linux kernel built in tools"
DESCRIPTION = " USB/IP protocol allows to pass USB device from server
to \
client over the network. Server is a machine which provides (shares)
a \
USB device. Client is a machine which uses USB device provided by
server \
over the network. The USB device may be either physical device
connected \
to a server or software entity created on a server using USB gadget
subsystem."

LICENSE = "GPLv2"
LIC_FILES_CHKSUM =
"file://${COMMON_LICENSE_DIR}/GPL-
2.0;md5=801f80980d171dd6425610833a22dbe6"
DEPENDS = "virtual/kernel libtool udev"
PROVIDES = "virtual/usbip-tools"

inherit linux-kernel-base kernel-arch kernelsrc manpages


do_populate_lic[depends] += "virtual/kernel:do_patch"
do_configure[depends] += "virtual/kernel:do_shared_workdir"

EXTRA_OEMAKE = "\
    -C ${S}/tools/usb/usbip \
    O=${B} \
    CROSS_COMPILE=${TARGET_PREFIX} \
    CROSS=${TARGET_PREFIX} \
    CC="${CC}" \
    CCLD="${CC}" \
    LD="${LD}" \
    AR="${AR}" \
    ARCH="${ARCH}" \
    TMPDIR="${B}" \
"

EXTRA_OEMAKE += "\
    'DESTDIR=${D}' \
    KERNEL_SRC=${STAGING_KERNEL_DIR} \
"

do_configure[depends] += "virtual/kernel:do_shared_workdir"

inherit autotools gettext

# stolen from autotools.bbclass

CONFIGUREOPTS = " --build=${BUILD_SYS} \
          --host=${HOST_SYS} \
          --target=${TARGET_SYS} \
          --prefix=${prefix} \
          --exec_prefix=${exec_prefix} \
          --bindir=${bindir} \
          --sbindir=${sbindir} \
          --libexecdir=${libexecdir} \
          --datadir=${datadir} \
          --sysconfdir=${sysconfdir} \
          --sharedstatedir=${sharedstatedir} \
          --localstatedir=${localstatedir} \
          --libdir=${libdir} \
          --includedir=${includedir} \
          --oldincludedir=${oldincludedir} \
          --infodir=${infodir} \
          --mandir=${mandir} \
          --disable-silent-rules \
          ${CONFIGUREOPT_DEPTRACK} \
          ${@append_libtool_sysroot(d)} \
"

do_configure_prepend () {
    cd ${S}/tools/usb/usbip
    ./cleanup.sh
    ./autogen.sh
    ./configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
}

do_compile() {
    oe_runmake
}

do_install() {
    oe_runmake DESTDIR=${D} install
}

PACKAGE_ARCH = "${MACHINE_ARCH}"

python do_package_prepend() {
    d.setVar('PKGV', d.getVar("KERNEL_VERSION", True).split("-")[0])
}

B = "${WORKDIR}/${BPN}-${PV}"


Join yocto@lists.yoctoproject.org to automatically receive all group messages.