Difference between SRC_URI and FILESEXTRAPATHS_prepend in bitbake

vivek picture vivek · Sep 21, 2017 · Viewed 11k times · Source

Why we need to give path of files in SRC_URI even though we are including the files path in FILESEXTRAPATHS_prepend variable. Like:

SUMMARY = "Simple Hello application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI = "file://Hello_1.c \
           file://Hello_2.c \
              "

do_compile() {
         oe_runmake
}

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

In the files folder I have two files hello1.c and hello2.c. When I remove SRC_URI it outputs the following error,

ERROR: Hello-1.0-r0 do_compile: oe_runmake failed

But if I remove FILESEXTRAPATHS_prepend it is working fine.

What is the purpose of the variable FILESEXTRAPATHS_prepend?

Why error occurs when I remove SRC_URI even though I'm including my files path in FILESEXTRAPATHS_prepend?

Answer

yoctotutor.com picture yoctotutor.com · Feb 20, 2018

Simple way let assume meta-layer/recipes-core/example
1. In above path created hello and hello.bb
2. Here hello is a directory having your source and other data and hello.bb is recipe.

Now

SRC_URI : The SRC_URI variable always checks the data in hello dir only. FILESEXTRAPATHS_prepend := "${THISDIR}:" : if you add this line in your recipe, then the SRC_URI variable checks the data in present directory where the hello.bb file present.

In your case

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

The SRC_URI variable check the data in files dir where the hello.bb present.

Note: Most of the time people will use this FILESEXTRAPATHS variable in .BBappend files to apply patches and other files to the recipe.

For every .bb file, the SRC_URI variable is used to specify which files to fetch the source from - either from an online repository or a local one, and the FILESEXTRAPATHS specifies where these files are looked for, and depends on your source path.