Sources: Downloading, patching and additional files

A recipes purpose is to describe how to take a software package and build it for your target device. The location of the source file (or files) is specified via the SRC_URI variable in the recipe. This can describe several types of URI's, the most common are:

http and https

Specifies files to be downloaded. A copy is stored locally so that future builds will not download the source again.

cvs, svn and git

Specifies that the files are to be retrieved using the specified version control system.


Plain files which are included locally. These can be used for adding documentation, init scripts or any other files that need to be added to build the package under openembedded.


Patches are plain files which are treated as patched and automatically applied.

If a http, https or file URI refers to a compressed file, an archive file or a compressed archive file, such as .tar.gz or .zip, then the files will be uncompressed and extracted from the archive automatically.

Archive files will be extracted from with the working directory, ${WORKDIR} and plain files will be copied into the same directory. Patches will be applied from within the unpacked source directory, ${S}. (Details on these directories is provided in the next section.)

The following example from the havp recipe shows a typical SRC_URI definition:

SRC_URI = "${PV}.tar.gz \
           file://sysconfdir-is-etc.patch;patch=1 \
           file://havp.init \
           file://doc.configure.txt \

This describes several files${PV}.tar.gz

This is the URI of the havp source code. Note the use of the ${PV} variable to specify the version. This is done to enable the recipe to be renamed for a new version without the need the edit the recipe itself. Because this is a .tar.gz compressed archive the file will be decompressed and extracted in the working dir ${WORKDIR}.


This is a local file that is used to patch the extracted source code. The patch=1 is what specifies that this is a patch. The patch will be applied from the unpacked source directory, ${S}. In this case ${S} will be ${WORKDIR}/havp-0.82, and luckily the havp-0.82.tar.gz file extracts itself into that directory (so no need to explicitly change ${S}).

file://havp.init file://doc.configure.txt file://volatiles.05_havp"

These are plain files which are just copied into the working directory ${WORKDIR}. These are then used during the install task in the recipe to provide init scripts, documentation and volatiles configuration information for the package.

Full details on the SRC_URI variable and all the support URI's is available in the SRC_URI variable section of the reference chapter.