I have successfully gotten yocto to build the USBIP-tools directory by
adding a bb recipe for it, see below. However, I am sure that I have
violated ever good and reasonable best practice! Therefore I am looking
for feedback on how to improve the recipe before I attempt to submit it
for inclusion in the database.
Feedback is welcome and desired! So please comment.
The issues I had to solve to get this recipe to work are:
1) the kernel source is removed from the
tmp/work-shared/raspberrypi-cm3/kernel-source when the kernel is done
building. I have not figured out how to keep this code populated so that
this recipe can access it. I have tried adding
DEPENDS = "virtual/kernel"
but this did not seem to keep the code around. Is there a best practice
for this?
2) the code is in kernel-source/tools/usb/usbip, and is based on
autotools. However, those autotools are hidden behind a few scrips:
autogen.sh -> runs "autoreconf -i -f -v"
and
cleanup.sh -> removes all of the autogen code.
The issue I am having is that these shell scripts are currently
modifying the work-shared/... copy and not a local copy. Should I be
concerned? If so how to copy the code to a more reasonable place and
then modify it? I saw something in the comments of the perf.bb code that
seams to do this....
3) is there a way to use (or should I) the autotools.bbclass? I have
taken some code out of there to properly setup for the configure step.
However, I feel that this is a dumb solution and I would rather reuse a
class here. But, as far as I can tell the autotools needs to load the
code from git and then configure it, but I only need the tools/usb/usbip
directory of the kernel.
4) If I were to use the autotools class it is looking for .config files,
but these are generated by the autoreconf program. How do I get the
class to kick this off? do_configure_prepend ()??
I think that is enough questions for now.
Thank you all for your help!
Chuck
-----------------code start-----------------------
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}"
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55063): https://lists.yoctoproject.org/g/yocto/message/55063
Mute This Topic: https://lists.yoctoproject.org/mt/86302278/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-