Yocto recipe: how to install in a specific folder

I created a Yocto recipe for my program. What are the default folders for creating an image from a recipe? During the creation of the image, I want to move the files to another folder, for example

"/ Opt / hug".

Should I just do "mv" or are there other options?

thank

+3


source to share


2 answers


I think you want to copy your compiled program to a folder such as ${bindir}

:

Quoting from Yocto ref-manual 1.1:
When specifying paths as part of the CONFFILES variable, it is recommended to use the appropriate path variables. For example, $ {sysconfdir}, not / etc or $ {bindir}, not / usr / bin. These variables are listed at the top of the meta / conf / bitbake.conf file in the source directory .

You can copy files from the working directory to any directory on the target file system. For example, take a look at the hello-world example (note that the example is from the 1.1 reference manual, but I haven't found it in the new version yet):



 DESCRIPTION = "Simple helloworld application"
 SECTION = "examples"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
 PR = "r0"

 SRC_URI = "file://helloworld.c"

 S = "${WORKDIR}"

 do_compile() {
    ${CC} helloworld.c -o helloworld
 }

 do_install() {
    install -d ${D}${bindir}
    install -m 0755 helloworld ${D}${bindir}
 }

      

In this example, the binary helloworld

will be copied onto /usr/bin

in your image (may also be /opt

, see source directory for variable definition).

+8


source


do_install () {

install -d ${D}{base_prefix}/opt/xyz/          
install -m ${WORKDIR}/yourbinary    ${D}${base_prefix}/opt/xyz/

      

}

FILES _ $ {PN} = "$ {base_prefix} / opt / *"



above 1st line creates a directory in imagedir in that opt ​​/ xvz /

The second line will copy your binary to select / xyz / dir

Using the third line to copy your opt / xyz / binary to yocto rootfs.

0


source







All Articles