During do_install
, the task copies the
built files along with their hierarchy to locations that
would mirror their locations on the target device.
The installation process copies files from the
${
S
}
,
${
B
}
,
and
${
WORKDIR
}
directories to the
${
D
}
directory to create the structure as it should appear on the
target system.
How your software is built affects what you must do to be sure your software is installed correctly. The following list describes what you must do for installation depending on the type of build system used by the software being built:
Autotools and CMake:
If the software your recipe is building uses Autotools
or CMake, the OpenEmbedded build
system understands how to install the software.
Consequently, you do not have to have a
do_install
task as part of your
recipe.
You just need to make sure the install portion of the
build completes with no issues.
However, if you wish to install additional files not
already being installed by
make install
, you should do this
using a do_install_append
function
using the install command as described in
the "Manual" bulleted item later in this list.
Other (using
make install
):
You need to define a
do_install
function in your
recipe.
The function should call
oe_runmake install
and will likely
need to pass in the destination directory as well.
How you pass that path is dependent on how the
Makefile
being run is written
(e.g. DESTDIR=${D}
,
PREFIX=${D}
,
INSTALLROOT=${D}
, and so forth).
For an example recipe using
make install
, see the
"Makefile-Based Package"
section.
Manual:
You need to define a
do_install
function in your
recipe.
The function must first use
install -d
to create the
directories under
${
D
}
.
Once the directories exist, your function can use
install
to manually install the
built software into the directories.
You can find more information on
install
at
http://www.gnu.org/software/coreutils/manual/html_node/install-invocation.html.
For the scenarios that do not use Autotools or
CMake, you need to track the installation
and diagnose and fix any issues until everything installs
correctly.
You need to look in the default location of
${D}
, which is
${WORKDIR}/image
, to be sure your
files have been installed correctly.
During the installation process, you might need to
modify some of the installed files to suit the target
layout.
For example, you might need to replace hard-coded paths
in an initscript with values of variables provided by
the build system, such as replacing
/usr/bin/
with
${bindir}
.
If you do perform such modifications during
do_install
, be sure to modify the
destination file after copying rather than before
copying.
Modifying after copying ensures that the build system
can re-execute do_install
if
needed.
oe_runmake install
, which can be
run directly or can be run indirectly by the
autotools
and
cmake
classes, runs make install
in
parallel.
Sometimes, a Makefile can have missing dependencies
between targets that can result in race conditions.
If you experience intermittent failures during
do_install
, you might be able to
work around them by disabling parallel Makefile
installs by adding the following to the recipe:
PARALLEL_MAKEINST = ""
See
PARALLEL_MAKEINST
for additional information.