In Yocto, how to use headers provided and copied by a kernel recipe?

  Kiến thức lập trình

Context

I am building a Xenomai4 patch for STM OpenST-Linux Yocto project .

The recipe looks like:

linux-stm32mp:

SUMMARY = "Xenomai4 Patch"
SECTION = "kernel"
LICENSE = "GPL-v2.0"

SRC_URI += "file://evl.patch"

KERNEL_DEFCONFIG = "defconfig"
KERNEL_CONFIG_FRAGMENTS = ...

...

#HERE IS THE MAGIC <<==
do_install:append(){
    install -d ${D}${includedir}/kevl/evl
    cd ${S}/include/uapi/evl && find . -type f -name "*.h" -exec install -m 644 ${S}/include/uapi/evl/{} ${D}${includedir}/kevl/evl/{}
}

PACKAGES =+ " kevl-headers "

FILES:kevl-headers += "${includedir}/kevl/evl/*


Then I created another recipe to build and install libevl (Not included for simplicity).

And finally I am creating a recipe for an application that uses them:

TestApp.bb:

SUMMARY = "Xenomai4 App"
LICENSE = "MIT"
PR = "r1"

DEPENDS = "libevl libgpiod linux-stm32mp"

SRC_URI = "file://CMakeLists.txt main.c"

S = "${WORKDIR}"

inherit cmake

FILES:${PN} += ${bindir}/TestApp

EXTRA_OECMAKE += "-DSTAGING_INCDIR=${STAGING_INCDIR}"

When building, it seems that the folder where kevl-headers files are installed does not match where TestApp attempt to take them:

TestApp STAGING_INCDIR=
./build/tmp-glibc/work/cortexa35-ostl-linux/testapp/1.0-r1/recipe-sysroot/usr/include
kev-headers saves them at:
./build/tmp-glibc/work/stm32mp2-ostl-linux/linux-stm32mp/6.1.82-stm32mp-r2-r0/packages-split/kevl-headers/usr/include

QUESTION

How to copy those headers files as demonstrated and access them from another recipe?

I am also open to suggestions of better approches.

ATTEMPTS

  1. I tried to add include_directories with ${STAGING_KERNEL_DIR} that seems to work well, but then I get compilation conflicts between headers (time.h, size_t not existing, etc..)
  2. I tried to copy the files from another recipe, this works partially and only 3-4 files are copied out of >10. Not sure why.
  3. Attempting to copy the file from the kernel recipe that creates them seems a good approach, if it would work.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT