Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yocto recipe : how to install in specific folder

I have created a Yocto recipe for my program. What are the default folders that are building image from recipe ? At the time of building image, I want to move my files to another folder like "/opt/xyz".

Should I simply do "mv" or is there any other options?

like image 554
surfnerd Avatar asked Jul 08 '15 12:07

surfnerd


2 Answers

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

Quote from Yocto ref-manual 1.1:
When specifying paths as part of the CONFFILES variable, it is good practice to use appropriate path variables. For example, ${sysconfdir} rather than /etc or ${bindir} rather than /usr/bin. You can find a list of these variables at the top of the meta/conf/bitbake.conf file in the Source Directory.

You can copy files from your working directory to any directory in the target filesystem. See the hello-world example for instance (note that the example is taken from the 1.1 reference manual, but I haven't found it yet in the newer version):

 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}
 }

 FILES_${PN} = "${bindir}"

In this example, the helloworld binary would be copied to /usr/bin on your image (could be /opt too, see Source Directory for the variable definition). Adjust FILES_${PN} var for ${sysconfdir} ${bindir} ${datadir} ${libdir} directories.

like image 135
flo Avatar answered Oct 13 '22 20:10

flo


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 the dir in imagedir in that opt/xvz/

2nd line copy your binary to opt/xyz/dir

3rd line use to copy of your opt/xyz/binary to yocto rootfs.

like image 41
yoctotutor.com Avatar answered Oct 13 '22 19:10

yoctotutor.com