Reputation: 3
I am new to Yocto and cmake. After looking and searching on internet I was able to make my own recipe and was able to successfully compile the code using cmake from Yocto recipe. But the binary compiled and generated is in the build folder where the code source files reside. How do I copy over the binaries from the build folder to the custom file system path when the image is generated using Yocto.
My .bb file currently looks like this:
#
# This file is the pscode recipe.
#
SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://src/* \
file://include/* \
file://CMakeLists.txt\
"
S = "${WORKDIR}"
do_configure() {
cmake ../
}
inherit pkgconfig cmake
do_install() {
install -d ${D}/home/first
cp -r ${WORKDIR} ${D}/home/first
#install -m 0755 ${S} ${D}/home/first
}
FILES_${PN} += "/home/first"
This runs into error
cp: cannot copy a directory <path-to-the-test-folder-in-temp> into itself, <path-to-the-test-folder-in-temp/image/home/first>
Can I someone please guide me. Thank you in advance.
Upvotes: 0
Views: 7325
Reputation: 1484
Like the comments suggested:
SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://src/* \
file://include/* \
file://CMakeLists.txt \
"
S = "${WORKDIR}"
inherit pkgconfig cmake
If the CMakeLists.txt uses the install command then bitbake will do the install for you and you won't need to define you own do_install. see cmake-documentation-install for details. Here the example for binaries:
install(TARGETS <your cmake target> DESTINATION bin)
From cmake install documentation:
If a full path (with a leading slash or drive letter) is given it is used directly. If a relative path is given it is interpreted relative to the value of the CMAKE_INSTALL_PREFIX variable.
Upvotes: 2