From the variable glossary manual of yocto kirkstone (https://docs.yoctoproject.org/4.0.30/ref-manual/variables.html):

S

The location in the Build Directory where unpacked recipe source code resides. By default, this directory is ${WORKDIR}/${BPN}-${PV}, where ${BPN} is the base recipe name and ${PV} is the recipe version. If the source tarball extracts the code to a directory named anything other than ${BPN}-${PV}, or if the source code is fetched from an SCM such as Git or Subversion, then you must set S in the recipe so that the OpenEmbedded build system knows where to find the unpacked source.

WORKDIR

The pathname of the work directory in which the OpenEmbedded build system builds a recipe. This directory is located within the TMPDIR directory structure and is specific to the recipe being built and the system for which it is being built.

If I want to create a simple hello world recipe, I would expect from the variable definition that the source file hello.c would be placed under S. However yocto only copies that to WORKDIR.

What is the reason for this ? Is the expectation on the developer to set the S variable correctly for each recipe or copy the files to S in a do_config task ?

6 Replies 6

It depends on the recipe. Either it's written explicitly or in the inherit camke or make etc.

BTW, don't choose the "Tooling" tab, if you want "normal" Stackoverflow Q and A where you can earn reputation. Stick with the default "Debugging"

I thought since Yocto Project is a tool for building, it should be posted here.

You thought right, it's an "experiment" the company behind the site does: Opinion-based questions alpha experiment on Stack Overflow

I'm happy to help you with any questions, but the answer will be buried in the discussion, instead of up voted to the top, like you're used to from stackoverflow. So it's not as useful for future users...

Do you have a concrete recipe where it's not clear?

I stumbled across a tutorial on the internet which clarified things for me, and backed up what you said.
https://github.com/Basel-Dawoud/Recipes-Examples-BootlinTutorial?tab=readme-ov-file#src_uri

When you specify a file in SRC_URI it will, by default, gets unpacked under WORKDIR, unless you explicitly change the unpack directory with the subdir parameter like:

SRC_URI = "file://hello.c;subdir=somedir"

this way you will find your file under ${WORKDIR}/somedir and thus you set S to that new directory:

S = "${WORKDIR}/somedir"

or set subdir directly to S like:

SRC_URI = "file://hello.c;subdir=${S}"

Think of S as the variable pointing to where your sources are unpacked under WORKDIR , it could be directly WORKDIR , but in newer Yocto releases this is forbidden as sources are no longer allowed to be unpacked under WORKDIR , to keep it clean.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.