How to add/modify files in the directories in Yocto?

Hi, how are you?
I have a question, how do I add or modify a directory within the operating system? I have a qt application already with the executable created, I would like to add a folder named app in the /usr/share directory. Inside the app folder I will have other files with already compiled qt applications. I would like to generate the build with the files, what do I need to do?

Best regards,

Allan Bicov

Hi @allanbic,

Please take a look at this article: Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center

Taking the hello-world example below, you can tell Yocto how to compile your app inside the do_compile and where it should be moved inside the do_install function.

# Compile hello-world from sources, no Makefile
do_compile() {
    ${CXX} -Wall hello-world.cpp -o hello-world
}

# Install binary to final directory /usr/bin
do_install() {
    install -d ${D}${bindir}
    install -m 0755 ${S}/hello-world ${D}${bindir}
}

The variables list here: 12 Variables Glossary — The Yocto Project ® dev documentation can help you as well to use Yocto variables instead of full paths hardcoded to your recipe (just like the D and bindir in the example).

This recipe will be located inside your custom meta-layer that you will add to your conf/bblayers.conf file.

Let me know if you need anything else.

Best Regards,
Hiago.